check if password is strong enough only if it's not an optional argument

This commit is contained in:
Kay0u 2020-11-25 11:14:15 +01:00
parent 6a550f9318
commit 93fd101663
No known key found for this signature in database
GPG key ID: AAFEEB16CFA2AE2D

View file

@ -2498,8 +2498,9 @@ class PasswordArgumentParser(YunoHostArgumentFormatParser):
if any(char in question.value for char in self.forbidden_chars):
raise YunohostError('pattern_password_app', forbidden_chars=self.forbidden_chars)
from yunohost.utils.password import assert_password_is_strong_enough
assert_password_is_strong_enough('user', question.value)
if not question.optional:
from yunohost.utils.password import assert_password_is_strong_enough
assert_password_is_strong_enough('user', question.value)
return super(PasswordArgumentParser, self)._post_parse_value(question)