Skip to content
Snippets Groups Projects
Commit fb4530d2 authored by Martin Mareš's avatar Martin Mareš
Browse files

Web: Field Email umí kontrolovat domény

parent 213df204
Branches
No related tags found
1 merge request!130Přísnější kontroly mailových adres
......@@ -74,13 +74,16 @@ class Points(Decimal):
class Email(Stripped, EmailField):
def __init__(self, label="E-mail", validators=None, **kwargs):
check_existence: bool
def __init__(self, label="E-mail", validators=None, check_existence: bool = False, **kwargs):
self.check_existence = check_existence
super().__init__(label, validators, **kwargs)
def pre_validate(field, form):
if field.data:
try:
field.data = mo.users.normalize_email(field.data)
field.data = mo.users.normalize_email(field.data, check_existence=field.check_existence)
except mo.CheckError as e:
raise wtforms.ValidationError(str(e))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment