diff --git a/locales/en.json b/locales/en.json index 6275250ae..d4d52c957 100644 --- a/locales/en.json +++ b/locales/en.json @@ -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", diff --git a/src/yunohost/utils/password.py b/src/yunohost/utils/password.py index 9527c7ff6..75fbf2d74 100644 --- a/src/yunohost/utils/password.py +++ b/src/yunohost/utils/password.py @@ -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')