def save(username, password, nickname): password = utils.md5(password) import uuid uid = uuid.uuid4().hex rds.set(User._uid % username, uid) rds.set(User._username % uid, username) rds.set(User._password % uid, password) rds.set(User._nickname % uid, nickname) rds.set(User._point % uid, 0)
def is_password_valid(uid, password): return rds.get(User._password % uid) == utils.md5(password)