Created
January 15, 2019 11:35
-
-
Save lunarplasma/bd26d91ddecdad50b732cd0063dc85c0 to your computer and use it in GitHub Desktop.
Flask-WTF password confirmation
This file contains hidden or 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
| """ Originally by S. Dahlgren: http://sebastiandahlgren.se/2013/06/14/password-confirmation-in-wtforms/ """ | |
| class UserForm(model_form(models.User)): | |
| """ Extend the ModelForm from MongoEngine """ | |
| password = wtf.PasswordField( | |
| 'Password', | |
| [ | |
| wtf.validators.Length(min=2), | |
| wtf.Required(), | |
| wtf.EqualTo('confirm', message='Passwords must match') | |
| ]) | |
| confirm = wtf.PasswordField('Repeat password') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment