Created
April 23, 2014 14:01
-
-
Save krak3n/11216290 to your computer and use it in GitHub Desktop.
Flask login form
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AuthenticationForm(Form): | |
email = TextField() | |
password = PasswordField() | |
def validate_password(form, field): | |
user = db.session.query(User).filter_by(email=form.email.data).first() | |
if not user: | |
raise ValidationError('Inccorect Email or Password combination') | |
if not verify_and_update_password(field.data, user): | |
raise ValidationError('Inccorect Email or Password combination') | |
login_user(user) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment