From d5977387f3e6716cc7594dc872539ccd7f130524 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonah=20Br=C3=BCchert?= Date: Thu, 28 Mar 2024 03:53:55 +0100 Subject: ldap: Fix creating accounts --- accounts/backend/user/ldap.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/accounts/backend/user/ldap.py b/accounts/backend/user/ldap.py index 24e9f93..64e29d4 100644 --- a/accounts/backend/user/ldap.py +++ b/accounts/backend/user/ldap.py @@ -4,7 +4,8 @@ import ldap3 from ldap3.utils.conv import escape_filter_chars from ldap3.utils.dn import escape_rdn -from ldap3.core.exceptions import LDAPInvalidCredentialsResult, LDAPException +from ldap3.core.exceptions import LDAPInvalidCredentialsResult, LDAPException, LDAPOperationResult +from ldap3.core.results import RESULT_SUCCESS from . import Backend, InvalidPasswordError, NoSuchUserError, ShouldNotHappen from accounts.models import Account @@ -226,8 +227,8 @@ class LdapBackend(Backend): (ldap3.MODIFY_ADD, ['%d' % (uidNumber + i + 1)]), ]}) - if conn.result['result'] == ldap3.RESULT_SUCCESS: + if conn.result['result'] == RESULT_SUCCESS: return uidNumber + i + 1 - except ldap3.LDAPOperationResult: + except LDAPOperationResult: pass raise ShouldNotHappen('Unable to get next uidNumber, try again.') -- cgit v1.2.3-1-g7c22