fix: update delete account request format
This commit is contained in:
parent
f572a05d10
commit
744a05906c
2 changed files with 6 additions and 2 deletions
|
|
@ -149,9 +149,11 @@ pub async fn delete_account(
|
||||||
let user: User = serde_json::from_value(user).map_err(|_| AppError::Internal)?;
|
let user: User = serde_json::from_value(user).map_err(|_| AppError::Internal)?;
|
||||||
|
|
||||||
// Verify the master password hash
|
// Verify the master password hash
|
||||||
|
let provided_hash = payload.master_password_hash
|
||||||
|
.ok_or_else(|| AppError::BadRequest("Missing master password hash".to_string()))?;
|
||||||
if !constant_time_eq(
|
if !constant_time_eq(
|
||||||
user.master_password_hash.as_bytes(),
|
user.master_password_hash.as_bytes(),
|
||||||
payload.master_password_hash.as_bytes(),
|
provided_hash.as_bytes(),
|
||||||
) {
|
) {
|
||||||
return Err(AppError::Unauthorized("Invalid password".to_string()));
|
return Err(AppError::Unauthorized("Invalid password".to_string()));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -79,5 +79,7 @@ pub struct KeyData {
|
||||||
#[derive(Debug, Deserialize)]
|
#[derive(Debug, Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct DeleteAccountRequest {
|
pub struct DeleteAccountRequest {
|
||||||
pub master_password_hash: String,
|
#[serde(alias = "MasterPasswordHash")]
|
||||||
|
pub master_password_hash: Option<String>,
|
||||||
|
pub otp: Option<String>,
|
||||||
}
|
}
|
||||||
Loading…
Reference in a new issue