Hash Gravatar emails with SHA-256

This commit is contained in:
ponas committed 2026-10-23 02:18:16 +02:00
1 parent 1c9a7411f8
commit 5a12bf951a
1 file changed
+2 -2
+2 -2
View File
@@ -245,8 +245,8 @@ class UserProfile(models.Model):
def image_url(self) -> str: def image_url(self) -> str:
if self.user.email: if self.user.email:
md5_hash = hashlib.md5(self.user.email.lower().strip().encode()).hexdigest() # noqa: S324 sha256_hash = hashlib.sha256(self.user.email.lower().strip().encode()).hexdigest()
return f"https://www.gravatar.com/avatar/{md5_hash}?d=identicon" return f"https://www.gravatar.com/avatar/{sha256_hash}?d=identicon"
return "" return ""