From ebd94ac0c14e43f74b5deb7de1cc5a064579bd0d Mon Sep 17 00:00:00 2001 From: aitzol Date: Fri, 29 Apr 2022 10:16:13 +0200 Subject: [PATCH] cn fix --- app.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app.py b/app.py index 07212f7..39232d0 100644 --- a/app.py +++ b/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']