I want to create a page to edit some user data, including the password. How can I change the password in my own view with Flask-Security?
Use hash_password
to hash the password with Flask-Security.
from flask_security.utils import hash_password
user.password = hash_password('Stack Overflow')
Unless you have a good reason not to, you should use the built-in change password view and form. Flask-Security offers the ability to customize both. Leaving the change password form in its own page is a common pattern.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With