Created
January 22, 2020 19:33
-
-
Save Porter97/d7b370c1f26290fc1600072197a456fd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#... | |
class ChangePasswordForm(FlaskForm): | |
old_password = PasswordField('Old password', validators=[DataRequired()]) | |
password = PasswordField('New password', validators=[ | |
DataRequired(), EqualTo('password2', message='Passwords must match.')]) | |
password2 = PasswordField('Confirm new password', | |
validators=[DataRequired()]) | |
submit = SubmitField('Update Password') | |
class PasswordResetRequestForm(FlaskForm): | |
email = StringField('Email', validators=[DataRequired(), Length(1, 64), | |
Email()]) | |
submit = SubmitField('Reset Password') | |
class PasswordResetForm(FlaskForm): | |
password = PasswordField('New Password', validators=[ | |
DataRequired(), EqualTo('password2', message='Passwords must match')]) | |
password2 = PasswordField('Confirm password', validators=[DataRequired()]) | |
submit = SubmitField('Reset Password') | |
class ChangeEmailForm(FlaskForm): | |
email = StringField('New Email', validators=[DataRequired(), Length(1, 64), | |
Email()]) | |
password = PasswordField('Password', validators=[DataRequired()]) | |
submit = SubmitField('Update Email Address') | |
def validate_email(self, field): | |
if User.query.filter_by(email=field.data.lower()).first(): | |
raise ValidationError('Email already registered.') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment