checking that we are in the cli interface

This commit is contained in:
cricriiiiii 2020-12-11 23:32:43 +01:00 committed by ljf (zamentur)
parent c2a730f26c
commit 4c25f442c1

View file

@ -325,8 +325,12 @@ 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]
# change_password is None if user_update is not called to change the password
if change_password is not None: if change_password is not None:
if not change_password: # when in the cli interface if the option to change the password is called
# without a specified value, change_password will be set to the const 0.
# In this case we prompt for the new password.
if msettings.get('interface') == 'cli' and not change_password:
change_password = msignals.prompt(m18n.n("ask_password"), True, True) 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)