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

Add 'Case' check to strength check and number strength check checks #1

Merged
merged 2 commits into from
Nov 16, 2022
Merged
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
39 changes: 28 additions & 11 deletions src/passeo/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,38 @@ def strengthcheck(password):
y = tail in response.text
length = len(password)
StrengthCheckQuiz = {
'Pwned': '',
'Length': '',
'Case': '',
}
if y == True:
StrengthCheckQuiz['Pwned'] = 'PASS: password has been pwned, please change it.'
if y == False:
StrengthCheckQuiz['Pwned'] = 'PASS: Your password has not been pwned, you are safe.'
if y == None:
StrengthCheckQuiz['Pwned'] = 'FAIL: An error has occurred, please try again.'
StrengthCheckQuiz['Pwned'] = '1/3: PASS: password has been pwned, please change it.'
elif y == False:
StrengthCheckQuiz['Pwned'] = '1/3: PASS: Your password has not been pwned, you are safe.'
elif y == None:
StrengthCheckQuiz['Pwned'] = '1/3: FAIL: An error has occurred, please try again.'
if length < 8:
StrengthCheckQuiz['Length'] = 'FAIL: Your password is too short, it is recommended to make it longer.'
StrengthCheckQuiz['Length'] = '2/3: FAIL: Your password is too short, it is recommended to make it longer.'

if length > 8 and length < 16:
StrengthCheckQuiz['Length'] = 'PASS: Your password is long enough! It could be longer, but is great.'
elif length >= 8 and length <= 16:
StrengthCheckQuiz['Length'] = '2/3: PASS: Your password is long enough! It could be longer, but is great.'

if length > 16:
StrengthCheckQuiz['Length'] = 'PASS: Your password is very long, good job!'
elif length > 16:
StrengthCheckQuiz['Length'] = '2/3: PASS: Your password is very long, good job!'

elif length == None:
StrengthCheckQuiz['Length'] = '2/3: FAIL: An error has occurred, please try again.'

if password.lower():
StrengthCheckQuiz['Case'] = '3/3: FAIL: Your password has lowercase letters, but not uppercase letters, it is recommended to add uppercase letters.'

elif password.upper():
StrengthCheckQuiz['Case'] = '3/3: FAIL: Your password has uppercase letters, however it is also recommended to add lowercase letters.'
elif password.lower() and password.upper():
StrengthCheckQuiz['Case'] = '3/3: PASS: Your password has both uppercase and lowercase letters, good job!'

elif password == None:
StrengthCheckQuiz['Case'] = '3/3: FAIL: An error has occurred, please try again.'
return str(StrengthCheckQuiz['Pwned']) + '\n' + str(StrengthCheckQuiz['Length'] + '\n' + str(StrengthCheckQuiz['Case']) + '\n' + 'The Passeo password strength test has ended. Any questions/bugs? Raise a issue on https://github.com/ArjunSharda/Passeo/issue.')

return str(StrengthCheckQuiz['Pwned']) + '\n' + str(StrengthCheckQuiz['Length'] + '\n' + 'The Passeo password strength test has ended. Any questions/bugs? Raise a issue on https://github.com/ArjunSharda/Passeo/issue.')
self.strengthcheck = strengthcheck