Skip to content
Snippets Groups Projects

Přísnější kontroly mailových adres

Merged Martin Mareš requested to merge mj/check-email into devel
All threads resolved!
1 file
+ 5
2
Compare changes
  • Side-by-side
  • Inline
+ 5
2
@@ -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))
Loading