Skip to content

Commit

Permalink
Merge #725: Fix bug wrong error message for password too long error
Browse files Browse the repository at this point in the history
8246f07 feat: min and max password length should be also valid (Jose Celano)
2e67cc1 fix: [#613] wrong error message for password too long error (Jose Celano)

Pull request description:

  Fix bug wrong error message for password too long error.

ACKs for top commit:
  josecelano:
    ACK 8246f07

Tree-SHA512: f65cda387d866a30be7950319ebe4f9ae7e5d6d337d1c3f842a4c890cc209247e7aab38e651dfd95f2ce94d7b00189758c7ce47325bb7a4cedb3fa55b45c55f8
  • Loading branch information
josecelano committed Sep 6, 2024
2 parents bcce077 + 8246f07 commit 8555651
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ pub enum ServiceError {

#[display(fmt = "Password too short")]
PasswordTooShort,
#[display(fmt = "Username too long")]
#[display(fmt = "Password too long")]
PasswordTooLong,
#[display(fmt = "Passwords don't match")]
PasswordsDontMatch,
Expand Down
4 changes: 2 additions & 2 deletions src/services/user.rs
Original file line number Diff line number Diff line change
Expand Up @@ -461,11 +461,11 @@ fn validate_password_constraints(

let password_length = password.len();

if password_length <= password_rules.min_password_length {
if password_length < password_rules.min_password_length {
return Err(ServiceError::PasswordTooShort);
}

if password_length >= password_rules.max_password_length {
if password_length > password_rules.max_password_length {
return Err(ServiceError::PasswordTooLong);
}

Expand Down

0 comments on commit 8555651

Please sign in to comment.