I’m developing a project using Flask, WTForms and MongoEngine. While writing the registration process I ran into a problem I keep running into; password confirmation with WTForms. So this time I decided to write down what I did to make it work.
I am using a ModelForm
provided by the Flask-MongoEngine
module in the example below. What is interesting here is the validators for the password
field. As you can see, I have added a validator called EqualTo
that will check that the password
field is equal to the newly added confirm
field.
That’s it! My model is intact and the error handling is all done by WTForms.