feat/fix: email format validation

This commit is contained in:
Timothy J. Baek 2024-01-02 16:22:48 -08:00
parent cbee5621c3
commit d8754b4486
3 changed files with 39 additions and 25 deletions

View file

@ -1,4 +1,5 @@
import hashlib
import re
def get_gravatar_url(email):
@ -21,3 +22,9 @@ def calculate_sha256(file):
for chunk in iter(lambda: file.read(8192), b""):
sha256.update(chunk)
return sha256.hexdigest()
def validate_email_format(email: str) -> bool:
if not re.match(r"[^@]+@[^@]+\.[^@]+", email):
return False
return True