Guest User

Untitled

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