mirror of
https://github.com/YunoHost/moulinette.git
synced 2024-09-03 20:06:31 +02:00
Update yunohost_user.py
This commit is contained in:
parent
2d70cdd831
commit
a3afd20f13
1 changed files with 6 additions and 10 deletions
|
@ -113,13 +113,9 @@ def user_create(username, firstname, lastname, mail, password):
|
||||||
raise YunoHostError(22, _("Domain not found : ")+ mail[mail.find('@')+1:])
|
raise YunoHostError(22, _("Domain not found : ")+ mail[mail.find('@')+1:])
|
||||||
|
|
||||||
user_added = os.system('/usr/sbin/smbldap-useradd -a -A 1 -m -M "'+ mail +'" -N "'+ firstname +'" -S "'+ lastname +'" -Z "objectclass=mailAccount,maildrop='+ username +'" -p '+ username)
|
user_added = os.system('/usr/sbin/smbldap-useradd -a -A 1 -m -M "'+ mail +'" -N "'+ firstname +'" -S "'+ lastname +'" -Z "objectclass=mailAccount,maildrop='+ username +'" -p '+ username)
|
||||||
|
pwd_changed = os.system('echo -e \''+ password +'\n'+ password +'\' | smbldap-passwd '+ username)
|
||||||
|
|
||||||
if user_added == 0:
|
if user_added == pwd_changed == 0:
|
||||||
char_set = string.ascii_uppercase + string.digits
|
|
||||||
salt = ''.join(random.sample(char_set,8))
|
|
||||||
salt = '$1$' + salt + '$'
|
|
||||||
attr_dict = {'userPassword': '{CRYPT}' + crypt.crypt(str(password), salt)}
|
|
||||||
if yldap.update('uid=' + username + ',ou=users', attr_dict):
|
|
||||||
#TODO: Send a welcome mail to user
|
#TODO: Send a welcome mail to user
|
||||||
win_msg(_("User successfully created"))
|
win_msg(_("User successfully created"))
|
||||||
return { _("Fullname") : firstname +' '+ lastname, _("Username") : username, _("Mail") : mail }
|
return { _("Fullname") : firstname +' '+ lastname, _("Username") : username, _("Mail") : mail }
|
||||||
|
|
Loading…
Add table
Reference in a new issue