user update -p without argument allowed

when not giving an argument (to avoid clear passwords in bash history) to "yunohost user update -p", now you are prompted for a password
This commit is contained in:
cricriiiiii 2020-11-17 16:39:28 +01:00 committed by ljf (zamentur)
parent e479b32674
commit c2a730f26c
2 changed files with 6 additions and 1 deletions

View file

@ -165,8 +165,11 @@ user:
full: --change-password full: --change-password
help: New password to set help: New password to set
metavar: PASSWORD metavar: PASSWORD
nargs: "?"
const: 0
extra: extra:
pattern: *pattern_password pattern: *pattern_password
comment: good_practices_about_user_password
--add-mailforward: --add-mailforward:
help: Mailforward addresses to add help: Mailforward addresses to add
nargs: "*" nargs: "*"

View file

@ -325,7 +325,9 @@ def user_update(operation_logger, username, firstname=None, lastname=None, mail=
if lastname and firstname: if lastname and firstname:
new_attr_dict['cn'] = new_attr_dict['displayName'] = [firstname + ' ' + lastname] new_attr_dict['cn'] = new_attr_dict['displayName'] = [firstname + ' ' + lastname]
if change_password: if change_password is not None:
if not change_password:
change_password = msignals.prompt(m18n.n("ask_password"), True, True)
# Ensure sufficiently complex password # Ensure sufficiently complex password
assert_password_is_strong_enough("user", change_password) assert_password_is_strong_enough("user", change_password)