def authenticate(self, passwd): if passwd == None: return false hash = sha256(passwd.encode("utf-8")) if hash == self.passwd.decode("utf-8"): return True else: return False
def setPasswd(self, passwd): hash = sha256(passwd.encode("utf-8")) self.passwd = hash super(User, self).save()