Esempio n. 1
0
 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
Esempio n. 2
0
File: db.py Progetto: planset/templa
 def set_password(self, password):
     self.password = get_password_hash(SECRET_KEY, self.username, password)