|
|
@ -19,14 +19,14 @@ class LoginForm(Form): |
|
|
|
|
|
|
|
|
|
|
|
self.user = User.query.filter_by(username=self.username.data).first() |
|
|
|
self.user = User.query.filter_by(username=self.username.data).first() |
|
|
|
if not self.user: |
|
|
|
if not self.user: |
|
|
|
self.username.errors.append("Unknown username") |
|
|
|
self.username.errors.append('Unknown username') |
|
|
|
return False |
|
|
|
return False |
|
|
|
|
|
|
|
|
|
|
|
if not self.user.check_password(self.password.data): |
|
|
|
if not self.user.check_password(self.password.data): |
|
|
|
self.password.errors.append("Invalid password") |
|
|
|
self.password.errors.append('Invalid password') |
|
|
|
return False |
|
|
|
return False |
|
|
|
|
|
|
|
|
|
|
|
if not self.user.active: |
|
|
|
if not self.user.active: |
|
|
|
self.username.errors.append("User not activated") |
|
|
|
self.username.errors.append('User not activated') |
|
|
|
return False |
|
|
|
return False |
|
|
|
return True |
|
|
|
return True |
|
|
|