feat(ldap) fix login on ldap

This commit is contained in:
Tim Gröger 2023-02-18 15:11:42 +01:00
parent a50ba403fc
commit d475f3f8e2
1 changed files with 3 additions and 1 deletions

View File

@ -61,7 +61,7 @@ class AuthLDAP(AuthPlugin):
def login(self, login_name, password):
if not login_name:
return False
return self.ldap.authenticate(login_name, password, "uid", self.base_dn)
return login_name if self.ldap.authenticate(login_name, password, "uid", self.base_dn) else False
def user_exists(self, userid) -> bool:
attr = self.__find(userid, None)
@ -306,3 +306,5 @@ class AuthLDAP(AuthPlugin):
except (LDAPPasswordIsMandatoryError, LDAPBindError):
raise BadRequest
except IndexError as e:
logger.error("Roles in LDAP", exc_info=True)