Guest User

Untitled

a guest
Oct 14th, 2018
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. class LoginForm (Form):
  2.  
  3.  
  4. username = TextField("Username")
  5. password = PasswordField("Password")
  6. submit = SubmitField("Login")
  7.  
  8. access_user = User.query.filter_by(email = username.data).first()
  9.  
  10. def validate_username(self,username):
  11.  
  12. if access_user is None:
  13. raise ValidateError, "Invalid Username"
  14.  
  15. def validate_password(self,password):
  16. condition = check_password_hash(access_user.password, password)
  17. if not condition:
  18. raise ValidateError, "Invalid Password"
Add Comment
Please, Sign In to add comment