[Plugin] auth_ldap: Fixed searching for non existing user
This commit is contained in:
parent
919a31bede
commit
c3c35e2a6a
|
@ -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"""
|
||||
|
|
Loading…
Reference in New Issue