Not sure to understand the whole logic behind this :/ To me this should as simple as this ?

This commit is contained in:
Alexandre Aubin 2018-10-25 19:03:41 +00:00
parent 55256c1973
commit 167df05f56
2 changed files with 4 additions and 8 deletions

View file

@ -329,14 +329,11 @@
"packages_no_upgrade": "There is no package to upgrade",
"packages_upgrade_critical_later": "Critical packages ({packages:s}) will be upgraded later",
"packages_upgrade_failed": "Unable to upgrade all of the packages",
"password_listed": "This password is among the most used password in the world. Please choose something a bit more unique.",
"password_too_simple_1": "Password needs to be at least 6 characters long",
"password_too_simple_2": "Password needs to be at least 8 characters long and contains digit, upper and lower characters",
"password_too_simple_3": "Password needs to be at least 8 characters long and contains digit, upper, lower and special characters",
"password_too_simple_4": "Password needs to be at least 12 characters long and contains digit, upper, lower and special characters",
"password_listed_1": "This password is in a well known list. Please make it unique. Password needs to be at least 6 characters long",
"password_listed_2": "This password is in a well known list. Please make it unique. Password needs to be at least 8 characters long and contains digit, upper and lower characters",
"password_listed_3": "This password is in a well known list. Please make it unique. Password needs to be at least 8 characters long and contains digit, upper, lower and special characters",
"password_listed_4": "This password is in a well known list. Please make it unique. Password needs to be at least 12 characters long and contains digit, upper, lower and special characters",
"password_advice": "Advice: a good password is at least 8 characters and contains digit, upper, lower and special characters",
"path_removal_failed": "Unable to remove path {:s}",
"pattern_backup_archive_name": "Must be a valid filename with max 30 characters, and alphanumeric and -_. characters only",

View file

@ -107,11 +107,10 @@ class PasswordValidator(object):
listed = password in SMALL_PWD_LIST or self.is_in_cracklib_list(password)
strength_level = self.strength_level(password)
if listed:
return ("error", "password_listed")
if strength_level < self.validation_strength:
if listed:
return ("error", "password_listed_" + str(self.validation_strength))
else:
return ("error", "password_too_simple_" + str(self.validation_strength))
return ("error", "password_too_simple_%s" % self.validation_strength)
if strength_level < 3:
return ("warning", 'password_advice')