diff --git a/src/passeo/__init__.py b/src/passeo/__init__.py index 26b9459..49df33e 100644 --- a/src/passeo/__init__.py +++ b/src/passeo/__init__.py @@ -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