[Plugin] auth_ldap: Fixed exception if no avatar is set on backend.
This commit is contained in:
parent
a4a9d05a31
commit
ba25d6177a
|
@ -137,11 +137,11 @@ class AuthLDAP(AuthPlugin):
|
|||
"ou=user,{}".format(self.dn),
|
||||
"(uid={})".format(user.userid),
|
||||
SUBTREE,
|
||||
attributes=["uid", "jpegPhoto"],
|
||||
attributes=["jpegPhoto"],
|
||||
)
|
||||
r = self.ldap.connection.response[0]["attributes"]
|
||||
|
||||
if r["uid"][0] == user.userid:
|
||||
if "jpegPhoto" in r and len(r["jpegPhoto"]) > 0:
|
||||
avatar = _Avatar()
|
||||
avatar.mimetype = "image/jpeg"
|
||||
avatar.binary.extend(r["jpegPhoto"][0])
|
||||
|
|
Loading…
Reference in New Issue