perf: update authenticated

This commit is contained in:
ibuler
2026-03-31 13:39:40 +08:00
parent 2e1a549126
commit 4f430e2dd7
2 changed files with 8 additions and 1 deletions

View File

@@ -92,7 +92,11 @@ class LDAPBaseBackend(LDAPBackend):
if not match:
logger.info('Authenticate failed: {}'.format(msg))
return None
ldap_user = LDAPUser(self, username=username.strip(), request=request)
try:
ldap_user = LDAPUser(self, username=username.strip(), request=request)
except Exception as e:
logger.error('Authenticate failed: {}'.format(e))
return None
user = self.authenticate_ldap_user(ldap_user, password)
logger.info('Authenticate user: {}'.format(user))
return user if self.user_can_authenticate(user) else None

View File

@@ -170,6 +170,9 @@ def authenticate(request=None, **credentials):
and the current user is not in the user list. Please contact the administrator.'''
)
continue
except Exception as e:
logger.error('Authenticate failed: {}'.format(e))
continue
if user is None:
continue