mirror of
https://github.com/YunoHost/moulinette.git
synced 2024-09-03 20:06:31 +02:00
Modify password with smbldap-passwd
This commit is contained in:
parent
319b013680
commit
6df6fb8efd
1 changed files with 3 additions and 4 deletions
|
@ -194,10 +194,9 @@ def user_update(username, firstname=None, lastname=None, mail=None, change_passw
|
||||||
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:
|
||||||
char_set = string.ascii_uppercase + string.digits
|
pwd_changed = os.system('echo "'+ password +'\n'+ password +'" | smbldap-passwd '+ username)
|
||||||
salt = ''.join(random.sample(char_set,8))
|
if pwd_changed > 0:
|
||||||
salt = '$1$' + salt + '$'
|
raise YunoHostError(169, _("An error occured during password update"))
|
||||||
new_attr_dict['userPassword'] = '{CRYPT}' + crypt.crypt(str(change_password), salt)
|
|
||||||
|
|
||||||
if mail:
|
if mail:
|
||||||
yldap.validate_uniqueness({ 'mail': mail })
|
yldap.validate_uniqueness({ 'mail': mail })
|
||||||
|
|
Loading…
Reference in a new issue