diff --git a/locales/en.json b/locales/en.json index d4d52c957..a25dab7da 100644 --- a/locales/en.json +++ b/locales/en.json @@ -334,7 +334,6 @@ "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_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", "pattern_domain": "Must be a valid domain name (e.g. my-domain.org)", diff --git a/src/yunohost/utils/password.py b/src/yunohost/utils/password.py index e3e82207b..1b9bde6f9 100644 --- a/src/yunohost/utils/password.py +++ b/src/yunohost/utils/password.py @@ -67,8 +67,8 @@ class PasswordValidator(object): def validate(self, password): """ - Check the validation_summary and trigger the corresponding - exception or info message + Check the validation_summary and trigger an exception + if the password does not pass tests. This method is meant to be used from inside YunoHost's code (compared to validation_summary which is meant to be called @@ -92,8 +92,6 @@ class PasswordValidator(object): status, msg = validation_summary(password) if status == "error": raise MoulinetteError(1, m18n.n(msg)) - elif status == "warning": - logger.info(m18n.n(msg)) def validation_summary(self, password): """ @@ -101,7 +99,7 @@ class PasswordValidator(object): and if the overall strength is good enough compared to the validation_strength defined in the constructor. - Produces a summary-tuple comprised of a level (success, error, warning) + Produces a summary-tuple comprised of a level (succes or error) and a message key describing the issues found. """ if self.validation_strength < 0: @@ -114,8 +112,6 @@ class PasswordValidator(object): if strength_level < self.validation_strength: return ("error", "password_too_simple_%s" % self.validation_strength) - if strength_level < 3: - return ("warning", 'password_advice') return ("success", "") def strength(self, password):