This commit is contained in:
aitzol 2022-04-29 10:16:13 +02:00
parent cee47b5ace
commit ebd94ac0c1
1 changed files with 2 additions and 3 deletions

5
app.py
View File

@ -30,7 +30,6 @@ from ldap3.core.exceptions import LDAPBindError, LDAPConstraintViolationResult,
LDAPSocketOpenError, LDAPExceptionError
import logging
from os import getenv, environ, path
#import re
from libs import flist, slist
from libs.localization import *
from libs.helper import *
@ -506,7 +505,7 @@ def register(conf, username, firstname, surname, password, email, isFake):
directory = 'home/user/'+to_ascii(username)
OBJECT_CLASS = ['top', 'inetOrgPerson', 'posixAccount', 'accountsManagement']
attributes = {'gidNumber': '501', 'uidNumber': uidNumber, 'homeDirectory': directory, 'givenName': firstname, 'sn': surname, 'uid' : username, 'mail': email, 'active': False, 'fakeCn': isFake}
new_user_dn = "cn="+firstname+" "+ surname+",cn=users,"+conf['base']
new_user_dn = "cn="+firstname+" "+surname+" - "+username+",cn=users,"+conf['base']
c.add(dn=new_user_dn,object_class=OBJECT_CLASS, attributes=attributes)
#create/change user password
c.extend.standard.modify_password(new_user_dn, '', password)
@ -562,7 +561,7 @@ def update_fullname(conf, username, firstname, surname):
user_dn = find_user_dn(conf, c, username)
c.modify(user_dn, {'givenName': [( MODIFY_REPLACE, firstname )], 'sn': [( MODIFY_REPLACE, surname )]})
new_cn = "cn="+firstname+" "+ surname
new_cn = "cn="+firstname+" "+ surname+" - "+ username
c.modify_dn(user_dn, new_cn)
new_user_dn = new_cn+",cn=users,"+conf['base']