Created
October 11, 2012 17:00
-
-
Save acuros/3873891 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class User(Base): | |
__tablename__ = 'user' | |
id = db.Column(db.Integer, primary_key=True) | |
username = db.Column(db.String(30), unique=True) | |
email = db.Column(db.String(120), unique=True) | |
password = db.Column(db.String(64)) | |
name = db.Column(db.String(30)) | |
def __init__(self, username, email, password, name=''): | |
self.username = username | |
self.email = email | |
self.password = hashlib.sha256(password) | |
self.name = name | |
def __repr__(self): | |
return '<User %r>'%self.username | |
def set_password(self, password): | |
self.password = hashlib.sha256(password) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment