Skip to content

Commit

Permalink
feat: min and max password length should be also valid
Browse files Browse the repository at this point in the history
In the condiguration uyou can set the min and max password length but
those values are not include (not valid).

```toml
[auth.password_constraints]
max_password_length = 64
min_password_length = 6
```

This commit allows password with 6 and 64 chars.
  • Loading branch information
josecelano committed Sep 6, 2024
1 parent 2e67cc1 commit 8246f07
Showing 1 changed file with 2 additions and 2 deletions.
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 8246f07

Please sign in to comment.