From afc968437daa74e1f55e59af623d56d0bde768a0 Mon Sep 17 00:00:00 2001 From: Brendon Allen Date: Tue, 26 Dec 2023 23:57:54 +1000 Subject: [PATCH] sources/ldap: fix Issue with changing passwords with eDirectory (#7997) * Issue with changing passwords with eDirectory #5851 Fixed authentik\sources\ldap\password.py to also catch the exception on LDAPNoSuchAttributeResult that is returned when Authentik tries to query LDAP with Microsoft to an eDirectory Server instead. * fix: Issue with changing passwords with eDirectory #5851 Fixed authentik\sources\ldap\password.py to also catch the exception on LDAPNoSuchAttributeResult that is returned when Authentik tries to query LDAP with Microsoft to an eDirectory Server instead. * Update authentik/sources/ldap/password.py Signed-off-by: Jens L. --------- Signed-off-by: Jens L. Co-authored-by: Brendon Allen Co-authored-by: Jens L --- authentik/sources/ldap/password.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/authentik/sources/ldap/password.py b/authentik/sources/ldap/password.py index d4e0dff4e..0593b2078 100644 --- a/authentik/sources/ldap/password.py +++ b/authentik/sources/ldap/password.py @@ -4,7 +4,11 @@ from re import split from typing import Optional from ldap3 import BASE -from ldap3.core.exceptions import LDAPAttributeError, LDAPUnwillingToPerformResult +from ldap3.core.exceptions import ( + LDAPAttributeError, + LDAPNoSuchAttributeResult, + LDAPUnwillingToPerformResult, +) from structlog.stdlib import get_logger from authentik.core.models import User @@ -97,7 +101,7 @@ class LDAPPasswordChanger: return try: self._connection.extend.microsoft.modify_password(user_dn, password) - except (LDAPAttributeError, LDAPUnwillingToPerformResult): + except (LDAPAttributeError, LDAPUnwillingToPerformResult, LDAPNoSuchAttributeResult): self._connection.extend.standard.modify_password(user_dn, new_password=password) def _ad_check_password_existing(self, password: str, user_dn: str) -> bool: