To me this doesnt make sense :| Either the password is accepted or it is not, but we shall not give advice to the user *after* validating the password...

This commit is contained in:
Alexandre Aubin 2018-10-25 19:39:08 +00:00
parent 354cd8106e
commit 319602537d
2 changed files with 3 additions and 8 deletions

View file

@ -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)",

View file

@ -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):