r-chowdhury / Flask-Course

API for Monty Python Store
0 stars 0 forks source link

Consider hashing password :-)))) #10

Open mzrzvi opened 6 years ago

mzrzvi commented 6 years ago

https://github.com/r-chowdhury/Flask-Course/blob/f637af46ba00c02e252f3dbcc26d0410af014f01/models/user.py#L14

from flask_security.utils import hash_password, verify_password
...
class UserModel(db.Model):
...
    def __init__(self, username, password):
        self.username = username
        self.password = hash_password(password)

    def authenticate(self, password):
        return verify_password(password, self.password)
mzrzvi commented 6 years ago

https://pythonhosted.org/Flask-Security/api.html?highlight=hash_password#flask_security.utils.hash_password

mzrzvi commented 6 years ago

For other reference: https://pythonhosted.org/Flask-Security/api.html?highlight=hash_password