Python flask_bcrypt.Bcrypt() Examples

The following are 2 code examples of flask_bcrypt.Bcrypt(). These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module flask_bcrypt , or try the search function .
Example #1
Source Project: flask-rest-api   Author: gitgik   File: models.py    License: MIT License 5 votes vote down vote up
def __init__(self, email, password):
        """Initialize the user with an email and a password."""
        self.email = email
        self.password = Bcrypt().generate_password_hash(password).decode() 
Example #2
Source Project: flask-rest-api   Author: gitgik   File: models.py    License: MIT License 5 votes vote down vote up
def password_is_valid(self, password):
        """
        Checks the password against it's hash to validates the user's password
        """
        return Bcrypt().check_password_hash(self.password, password)