cn fix
This commit is contained in:
parent
cee47b5ace
commit
ebd94ac0c1
5
app.py
5
app.py
@ -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']
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user