Merge pull request #107 from elitest/fix-gravatar

Fix NoneType error when logging in with AD
This commit is contained in:
Khanh Ngo 2016-08-16 09:37:00 +07:00 committed by GitHub
commit d5fd1cc6d6

View File

@ -149,5 +149,13 @@ def pdns_api_extended_uri(version):
return ""
def email_to_gravatar_url(email, size=100):
"""
AD doesn't necessarily have email
"""
if not email:
email=""
hash_string = hashlib.md5(email).hexdigest()
return "https://s.gravatar.com/avatar/%s?s=%s" % (hash_string, size)