Compare commits

..

No commits in common. 'c733a550ec4f8b197d92f2ad3a759141146d7799' and '52b8225f12bcc975f4544ab3ae69922feee77f05' have entirely different histories.

  1. 31
      backend/utils/utils.py

@ -30,33 +30,4 @@ def is_valid_email(email):
if re.match(pattern, email):
return True
else:
return False
def password_check(passwd: str) -> bool:
special_symbol_pattern = r'[$@#%]'
upper_case_pattern = r'[A-Z]'
lower_case_pattern = r'[a-z]'
digit_pattern = r'[0-9]'
if len(passwd) < 6:
raise InsecurePasswordException('Password length should be at least 6 characters.')
elif len(passwd) > 20:
raise InsecurePasswordException('Password length should not be greater than 20 characters.')
if not re.search(digit_pattern, passwd):
raise InsecurePasswordException('Password should have at least one numeral.')
if not re.search(upper_case_pattern, passwd):
raise InsecurePasswordException('Password should have at least one uppercase letter.')
if not re.search(lower_case_pattern, passwd):
raise InsecurePasswordException('Password should have at least one lowercase letter.')
if not re.search(special_symbol_pattern, passwd):
raise InsecurePasswordException('Password should have at least one of the symbols $@#%.')
return True
class InsecurePasswordException(Exception):
pass
return False
Loading…
Cancel
Save