Skip to content

Instantly share code, notes, and snippets.

@hughes
Created September 29, 2014 02:48
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hughes/014103d2b0e097329e1c to your computer and use it in GitHub Desktop.
Save hughes/014103d2b0e097329e1c to your computer and use it in GitHub Desktop.
from passlib.apps import custom_app_context as pwd_context
class User(db.Model):
# ...
def set_password(self, password):
self.password_hash = pwd_context.encrypt(password)
def verify_password(self, password):
return pwd_context.verify(password, self.password_hash)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment