Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Password validator checks for uppercase letters #402

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
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
12 changes: 8 additions & 4 deletions PASSWORD RELATED/password-validator/PASSWORD_VALIDATOR.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def passwordValidator():
print('\nYour password should: ')
print('\t- Have a minimum length of 6;')
print('\t- Have a maximum length of 12;')
print('\t- Contain at least an uppercase letter or a lowercase letter')
print('\t- Contain at least an uppercase letter and a lowercase letter;')
print('\t- Contain at least a number;')
print('\t- Contain at least a special character (such as @,+,£,$,%,*^,etc);')
print('\t- Not contain space(s).')
Expand All @@ -24,9 +24,13 @@ def passwordValidator():
if ' ' in userPassword:
message = 'Invalid Password..your password shouldn\'t contain space(s)'
return message
if not any(i in string.ascii_letters for i in userPassword):
if not any(i in string.ascii_letters.upper() for i in userPassword):
message = 'Invalid Password..your password should contain at least '
message += 'an uppercase letter and a lowercase letter'
message += 'an uppercase letter'
return message
if not any(i in string.ascii_letters.lower() for i in userPassword):
message = 'Invalid Password..your password should contain at least '
message += 'a lowercase letter'
return message
if not any(i in string.digits for i in userPassword):
message = 'Invalid Password..your password should contain at least a number'
Expand All @@ -38,4 +42,4 @@ def passwordValidator():
return 'Valid Password!'

my_password = passwordValidator()
print(my_password)
print(my_password)
Loading