Skip to content

Commit

Permalink
Merge pull request #1 from ArjunSharda/Add_Case_strengthcheck
Browse files Browse the repository at this point in the history
Add 'Case' check to strength check and number strength check checks
  • Loading branch information
ArjunSharda authored Nov 16, 2022
2 parents 63b47b1 + 3d230f2 commit 91e10c1
Showing 1 changed file with 28 additions and 11 deletions.
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

0 comments on commit 91e10c1

Please sign in to comment.