Skip to content

Instantly share code, notes, and snippets.

@lunarplasma
Created January 15, 2019 11:35
Show Gist options
  • Select an option

  • Save lunarplasma/bd26d91ddecdad50b732cd0063dc85c0 to your computer and use it in GitHub Desktop.

Select an option

Save lunarplasma/bd26d91ddecdad50b732cd0063dc85c0 to your computer and use it in GitHub Desktop.
Flask-WTF password confirmation
""" 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