fix: allow special characters in email (#5327)

Co-authored-by: crazywoola <427733928@qq.com>
This commit is contained in:
Mitsuki Ogasahara
2024-06-17 22:32:59 +09:00
committed by GitHub
parent edffa5666d
commit 7305713b97
4 changed files with 29 additions and 5 deletions

View File

@@ -25,7 +25,7 @@ class TimestampField(fields.Raw):
def email(email):
# Define a regex pattern for email addresses
pattern = r"^[\w\.-]+@([\w-]+\.)+[\w-]{2,}$"
pattern = r"^[\w\.!#$%&'*+\-/=?^_`{|}~]+@([\w-]+\.)+[\w-]{2,}$"
# Check if the email matches the pattern
if re.match(pattern, email) is not None:
return email