From ba25d6177ad9c3bbd957115a961bf20838776edf Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Wed, 27 Jan 2021 02:34:04 +0100 Subject: [PATCH] [Plugin] auth_ldap: Fixed exception if no avatar is set on backend. --- 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 f666397..b07cf36 100644 --- a/flaschengeist/plugins/auth_ldap/__init__.py +++ b/flaschengeist/plugins/auth_ldap/__init__.py @@ -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])