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"""