1
0
mirror of https://github.com/Mailu/Mailu.git synced 2025-09-16 09:06:32 +02:00

Better regexp

This commit is contained in:
Florent Daigniere
2023-12-20 11:41:45 +01:00
parent 422f005c3f
commit 30574445e4

View File

@@ -38,8 +38,8 @@ class MultipleEmailAddressesVerify(object):
self.message = message
def __call__(self, form, field):
pattern = re.compile(r'^([_a-z0-9\-\+]+)(\.[_a-z0-9\-\+]+)*@([a-z0-9\-]{1,}\.)*([a-z]{1,})(,([_a-z0-9\-\+]+)(\.[_a-z0-9\-\+]+)*@([a-z0-9\-]{1,}\.)*([a-z]{2,}))*$')
if not pattern.match(field.data.lower().replace(" ", "")):
pattern = re.compile(r"^(?:\s*\S+@([a-z0-9\-]{1,}\.)*([a-z]{1,})[\s|,]*)+$", re.IGNORECASE)
if not pattern.match(field.data.replace(" ", "")):
raise validators.ValidationError(self.message)
class MultipleFoldersVerify(object):