Complete the code to import the password hashing function.
from werkzeug.security import [1]
The generate_password_hash function is used to create a hashed password for security.
Complete the code to define the password field in the User model.
password_hash = db.Column(db.[1](128), nullable=False)
The password hash is stored as a string with a max length, so String is the correct column type.
Fix the error in the method that sets the password hash.
def set_password(self, password): self.password_hash = [1](password)
The generate_password_hash function creates a secure hash from the password string.
Fill both blanks to complete the method that verifies a password.
def check_password(self, password): return [1](self.password_hash, [2])
The check_password_hash function compares the stored hash with the given password string.
Fill all three blanks to complete the User model with password methods.
class User(db.Model): id = db.Column(db.Integer, primary_key=True) username = db.Column(db.String(64), unique=True, nullable=False) password_hash = db.Column(db.String(128), nullable=False) def set_password(self, password): self.password_hash = [1](password) def check_password(self, password): return [2](self.password_hash, [3])
The set_password method uses generate_password_hash to create the hash. The check_password method uses check_password_hash to verify the password against the stored hash.