mirror of
https://github.com/moepman/bk-dss
synced 2024-12-22 23:04:26 +01:00
Simplify form validation.
This commit is contained in:
parent
42718082a1
commit
516b448422
7
index.py
7
index.py
@ -23,8 +23,8 @@ class ReadonlyStringField(StringField):
|
|||||||
|
|
||||||
class EditForm(Form):
|
class EditForm(Form):
|
||||||
user = ReadonlyStringField('Username')
|
user = ReadonlyStringField('Username')
|
||||||
pwd1 = PasswordField('New Password')
|
pwd1 = PasswordField('New Password', validators = [Required()])
|
||||||
pwd2 = PasswordField('New Password (repeat)')
|
pwd2 = PasswordField('New Password (repeat)', validators = [Required(), EqualTo('pwd1', "Passwords must match")])
|
||||||
submit = SubmitField('Submit')
|
submit = SubmitField('Submit')
|
||||||
|
|
||||||
class LoginForm(Form):
|
class LoginForm(Form):
|
||||||
@ -59,9 +59,6 @@ def edit():
|
|||||||
user = rdb.hget(session['uuid'], 'user')
|
user = rdb.hget(session['uuid'], 'user')
|
||||||
|
|
||||||
if form.validate_on_submit():
|
if form.validate_on_submit():
|
||||||
if form.pwd1.data != form.pwd2.data:
|
|
||||||
form.pwd2.errors.append("Passwords do not match.")
|
|
||||||
else:
|
|
||||||
opwd = rdb.hget(session['uuid'], 'pswd')
|
opwd = rdb.hget(session['uuid'], 'pswd')
|
||||||
npwd = form.pwd1.data
|
npwd = form.pwd1.data
|
||||||
l = ldap.initialize(app.config.get('LDAP_URI', 'ldaps://127.0.0.1'))
|
l = ldap.initialize(app.config.get('LDAP_URI', 'ldaps://127.0.0.1'))
|
||||||
|
Loading…
Reference in New Issue
Block a user