示例#1
0
文件: forms.py 项目: planset/templa
 def validate_password(form, field):
     user = UserModel().get_by_username(form.username.data) 
     if user is None:
         raise ValidationError("auth error")
     entry_password = get_password_hash(settings.SECRET_KEY, user.username, field.data)
     if entry_password != user.password:
         raise ValidationError("auth error")
     form.user = user
示例#2
0
文件: db.py 项目: planset/templa
 def set_password(self, password):
     self.password = get_password_hash(SECRET_KEY, self.username, password)