def signin(self,email,passwd): email = email.lower() passwd=tomd5(passwd) result = db.select(TABLE_USER,where='email=$email',vars=locals()) if result: r=result[0] user = User() user.email=r['email'] user.nickname=r['nickname'] user.cellphone=r['cellphone'] user.status = r['status'] pwindb=r['passwd'] #TODO compare char by char? if pwindb == passwd: return user return None
def persistUser(self,username,email,password): user = User() user.username = username user.hashed_password = hashlib.sha256(password).hexdigest() user.email = email return user.put().id()