Hash Gravatar emails with SHA-256
This commit is contained in:
1 file changed
+2
-2
+2
-2
@@ -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 ""
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user