Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Odevzdávací Systém MO
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Martin Mareš
Odevzdávací Systém MO
Merge requests
!130
Přísnější kontroly mailových adres
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Přísnější kontroly mailových adres
mj/check-email
into
devel
Overview
4
Commits
7
Changes
1
All threads resolved!
Hide all comments
Merged
Martin Mareš
requested to merge
mj/check-email
into
devel
2 years ago
Overview
4
Commits
7
Changes
1
All threads resolved!
Hide all comments
Expand
Zavedeny přísnější kontroly mailových adres podle Issue
#308 (closed)
.
0
0
Merge request reports
Viewing commit
fb4530d2
Prev
Next
Show latest version
1 file
+
5
−
2
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
fb4530d2
Web: Field Email umí kontrolovat domény
· fb4530d2
Martin Mareš
authored
2 years ago
mo/web/fields.py
+
5
−
2
Options
@@ -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