From c3c35e2a6a8bf13687275b0f28b22e8b749dd9fb Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Sun, 14 Mar 2021 15:53:14 +0100 Subject: [PATCH] [Plugin] auth_ldap: Fixed searching for non existing user --- flaschengeist/plugins/auth_ldap/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/flaschengeist/plugins/auth_ldap/__init__.py b/flaschengeist/plugins/auth_ldap/__init__.py index 7bcefc7..c3ae7c6 100644 --- a/flaschengeist/plugins/auth_ldap/__init__.py +++ b/flaschengeist/plugins/auth_ldap/__init__.py @@ -54,7 +54,7 @@ class AuthLDAP(AuthPlugin): def find_user(self, userid, mail=None): attr = self.__find(userid, mail) - if attr: + if attr is not None: user = User(userid=attr["uid"][0]) self.__update(user, attr) return user @@ -186,7 +186,7 @@ class AuthLDAP(AuthPlugin): SUBTREE, attributes=["uid", "givenName", "sn", "mail"], ) - return con.response[0]["attributes"] + return con.response[0]["attributes"] if len(con.response) > 0 else None def __update(self, user, attr): """Update an User object with LDAP attributes"""