Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
BLEMENT33 committed Mar 18, 2024
1 parent cb76335 commit 76f604b
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions app/utils/validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,6 @@


def password_validator(password: str) -> str:
"""
Check the password strength, validity and remove trailing spaces.
This function is intended to be used as a Pydantic validator:
https://pydantic-docs.helpmanual.io/usage/validators/#reuse-validators
"""
# TODO
nb_number, nb_special, nb_maj, nb_min = 0, 0, 0, 0
for i in password:
if i.isnumeric():
Expand All @@ -22,13 +16,7 @@ def password_validator(password: str) -> str:
elif i.islower():
nb_min += 1

if (
len(password) < 6
and nb_number < 1
and nb_special < 1
and nb_min < 1
and nb_maj < 1
):
if len(password) < 6 or nb_number < 1 or nb_special < 1 or nb_min < 1 or nb_maj < 1:
raise ValueError(
"The password must be at least 6 characters long and contain at least one number, one special character, one majuscule and one minuscule.",
)
Expand Down

0 comments on commit 76f604b

Please sign in to comment.