[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),
|
"ou=user,{}".format(self.dn),
|
||||||
"(uid={})".format(user.userid),
|
"(uid={})".format(user.userid),
|
||||||
SUBTREE,
|
SUBTREE,
|
||||||
attributes=["uid", "jpegPhoto"],
|
attributes=["jpegPhoto"],
|
||||||
)
|
)
|
||||||
r = self.ldap.connection.response[0]["attributes"]
|
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 = _Avatar()
|
||||||
avatar.mimetype = "image/jpeg"
|
avatar.mimetype = "image/jpeg"
|
||||||
avatar.binary.extend(r["jpegPhoto"][0])
|
avatar.binary.extend(r["jpegPhoto"][0])
|
||||||
|
|
Loading…
Reference in New Issue