feat(reset): added a name validator
This commit is contained in:
13
app/reset.py
13
app/reset.py
@@ -20,15 +20,16 @@ class ResetPasswordForm(FlaskForm):
|
||||
# Form
|
||||
username = StringField(label=('Login'),
|
||||
validators=[DataRequired(),
|
||||
Length(max=64)])
|
||||
Length(max=64)],
|
||||
render_kw={"onkeyup": "validate_username()"})
|
||||
currentpassword = PasswordField(label=('Current password'),
|
||||
validators=[DataRequired()])
|
||||
newpassword = PasswordField(label=('New password'),
|
||||
validators=[DataRequired(),
|
||||
Length(min=minlength, message='Password should be at least %(min)d characters long'),
|
||||
Regexp("^(?=.*[a-z])", message="Password must have a lowercase character"),
|
||||
Regexp("^(?=.*[A-Z])", message="Password must have an uppercase character"),
|
||||
Regexp("^(?=.*\\d)", message="Password must contain a number"),
|
||||
Length(min=minlength),
|
||||
Regexp("^(?=.*[a-z])"),
|
||||
Regexp("^(?=.*[A-Z])"),
|
||||
Regexp("^(?=.*\\d)"),
|
||||
#Regexp(
|
||||
# "(?=.*[@$!%*#?&])", message="Password must contain a special character"
|
||||
#),],
|
||||
@@ -37,7 +38,7 @@ class ResetPasswordForm(FlaskForm):
|
||||
confirm_password = PasswordField(
|
||||
label=('Confirm Password'),
|
||||
validators=[DataRequired(message='* Required'),
|
||||
EqualTo('newpassword', message='Both password fields must be equal!')],
|
||||
EqualTo('newpassword')],
|
||||
render_kw={"onkeyup": f"validate_confirm({minlength})"})
|
||||
|
||||
submit = SubmitField(label=('Change my password'), render_kw={"onclick": f"validate_form({minlength})"})
|
||||
|
||||
Reference in New Issue
Block a user