Dustin Kaiser
commited on
Commit
·
5dc49d0
1
Parent(s):
ebde808
Enhance email validation: Allow top-level domains with 5 letters (#2856)
Browse files### What problem does this PR solve?
Currently singing up to ragflow using a mail-adress with associated
top-level domains that have more than 4 chars will fail due to a regex
validation that enforces just this.
In our use case, we'd like to use e-mail addresses with `.swiss`
top-level domains, which is a valid TLD associated with the country
switzerland in the IANA root database.
This change makes the validation accept 5-letter TLDs.
### Type of change
- [x] Bug Fix (non-breaking change which fixes an issue)
- [x] Other (please describe): Making validation for lenient, accepting
more valid input.
- api/apps/user_app.py +1 -1
api/apps/user_app.py
CHANGED
@@ -354,7 +354,7 @@ def user_add():
|
|
354 |
email_address = req["email"]
|
355 |
|
356 |
# Validate the email address
|
357 |
-
if not re.match(r"^[\w\._-]+@([\w_-]+\.)+[\w-]{2,
|
358 |
return get_json_result(data=False,
|
359 |
retmsg=f'Invalid email address: {email_address}!',
|
360 |
retcode=RetCode.OPERATING_ERROR)
|
|
|
354 |
email_address = req["email"]
|
355 |
|
356 |
# Validate the email address
|
357 |
+
if not re.match(r"^[\w\._-]+@([\w_-]+\.)+[\w-]{2,5}$", email_address):
|
358 |
return get_json_result(data=False,
|
359 |
retmsg=f'Invalid email address: {email_address}!',
|
360 |
retcode=RetCode.OPERATING_ERROR)
|