Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions crates/handlers/src/graphql/mutations/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ async fn verify_password_if_needed(
password,
user_password.hashed_password,
)
.await;
.await?;

Ok(res.is_ok())
Ok(res.is_success())
}
5 changes: 3 additions & 2 deletions crates/handlers/src/graphql/mutations/user.rs
Original file line number Diff line number Diff line change
Expand Up @@ -737,13 +737,14 @@ impl UserMutations {
));
};

if let Err(_err) = password_manager
if !password_manager
.verify(
active_password.version,
Zeroizing::new(current_password_attempt),
active_password.hashed_password,
)
.await
.await?
.is_success()
{
return Ok(SetPasswordPayload {
status: SetPasswordStatus::WrongPassword,
Expand Down
5 changes: 5 additions & 0 deletions crates/handlers/src/passwords.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ impl<T> PasswordVerificationResult<T> {
Self::Failure => PasswordVerificationResult::Failure,
}
}

#[must_use]
pub fn is_success(&self) -> bool {
matches!(self, Self::Success(_))
}
}

impl From<bool> for PasswordVerificationResult<()> {
Expand Down
Loading