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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
MO-P
Odevzdávací Systém MO
Merge requests
!86
Project 'mj/mo-submit' was moved to 'mo-p/osmo'. Please update any links and bookmarks that may still have the old path.
Registrace
Code
Review changes
Check out branch
Download
Patches
Plain diff
Expand sidebar
Merged
Registrace
mj/registrace
into
devel
Overview
49
Commits
38
Changes
1
Merged
Registrace
Martin Mareš
requested to merge
mj/registrace
into
devel
Jul 13, 2021
Overview
13
Commits
38
Changes
1
Implementace registrace podle
#220 (closed)
.
Edited
Aug 19, 2021
by
Martin Mareš
0
0
Merge request reports
Viewing commit
6dbb1359
Prev
Next
Show latest version
1 file
+
21
−
0
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
6dbb1359
mo.fields: Přidáno NewPassword a RepeatPassword
· 6dbb1359
Martin Mareš
authored
Jul 30, 2021
mo/web/fields.py
+
22
−
0
View file @ c60ca241
Edit in single-file editor
Open in Web IDE
Show full file
@@ -133,8 +133,30 @@ class School(Place):
def
load_place
(
field
)
->
None
:
field
.
place
=
None
field
.
place_error
=
""
if
field
.
data
:
try
:
field
.
place
=
mo
.
users
.
validate_and_find_school
(
field
.
data
)
except
mo
.
CheckError
as
e
:
field
.
place_error
=
str
(
e
)
class
NewPassword
(
wtforms
.
PasswordField
):
def
__init__
(
self
,
label
=
"
Nové heslo
"
,
validators
=
None
,
**
kwargs
):
super
().
__init__
(
label
,
validators
,
**
kwargs
)
def
pre_validate
(
field
,
form
):
if
field
.
data
:
if
not
mo
.
users
.
validate_password
(
field
.
data
):
raise
wtforms
.
ValidationError
(
mo
.
users
.
password_help
)
class
RepeatPassword
(
wtforms
.
PasswordField
):
"""
Pro validaci hledá ve formuláři form.new_passwd a s ním porovnává.
"""
def
__init__
(
self
,
label
=
"
Zopakujte heslo
"
,
validators
=
None
,
**
kwargs
):
super
().
__init__
(
label
,
validators
,
**
kwargs
)
def
pre_validate
(
field
,
form
):
if
field
.
data
!=
form
.
new_passwd
.
data
:
raise
wtforms
.
ValidationError
(
'
Hesla se neshodují.
'
)
Loading