mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2025-06-11 08:30:41 +00:00
normalize forms
This commit is contained in:
@ -9,28 +9,13 @@ from wtforms import (
|
||||
SubmitField,
|
||||
ValidationError
|
||||
)
|
||||
from wtforms.validators import DataRequired, Email, EqualTo, Length, Regexp
|
||||
from wtforms.validators import DataRequired, InputRequired, Email, EqualTo, Length, Regexp
|
||||
|
||||
|
||||
class ChangePasswordForm(FlaskForm):
|
||||
password = PasswordField('Old password', validators=[DataRequired()])
|
||||
new_password = PasswordField(
|
||||
'New password',
|
||||
validators=[
|
||||
DataRequired(),
|
||||
EqualTo(
|
||||
'new_password_confirmation',
|
||||
message='Passwords must match'
|
||||
)
|
||||
]
|
||||
)
|
||||
new_password_confirmation = PasswordField(
|
||||
'Confirm new password',
|
||||
validators=[
|
||||
DataRequired(),
|
||||
EqualTo('new_password', message='Passwords must match')
|
||||
]
|
||||
)
|
||||
new_password = PasswordField('New password', validators=[DataRequired(), EqualTo('new_password_confirmation', message='Passwords must match')])
|
||||
new_password_confirmation = PasswordField('Confirm new password', validators=[DataRequired(), EqualTo('new_password', message='Passwords must match')])
|
||||
submit = SubmitField('Submit')
|
||||
|
||||
def __init__(self, user, *args, **kwargs):
|
||||
@ -43,14 +28,11 @@ class ChangePasswordForm(FlaskForm):
|
||||
|
||||
|
||||
class EditGeneralSettingsForm(FlaskForm):
|
||||
email = StringField(
|
||||
'E-Mail',
|
||||
validators=[DataRequired(), Length(1, 254), Email()]
|
||||
)
|
||||
email = StringField('E-Mail', validators=[DataRequired(), Length(1, 254), Email()])
|
||||
username = StringField(
|
||||
'Username',
|
||||
validators=[
|
||||
DataRequired(),
|
||||
InputRequired(),
|
||||
Length(1, 64),
|
||||
Regexp(
|
||||
USERNAME_REGEX,
|
||||
|
Reference in New Issue
Block a user