From d475f3f8e2a1950b39d365c756a42f1024bc407f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Gr=C3=B6ger?= Date: Sat, 18 Feb 2023 15:11:42 +0100 Subject: [PATCH] feat(ldap) fix login on ldap --- flaschengeist/plugins/auth_ldap/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/flaschengeist/plugins/auth_ldap/__init__.py b/flaschengeist/plugins/auth_ldap/__init__.py index 2f76498..8a99284 100644 --- a/flaschengeist/plugins/auth_ldap/__init__.py +++ b/flaschengeist/plugins/auth_ldap/__init__.py @@ -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)