| Conditions | 4 |
| Total Lines | 19 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | from flask_wtf import Form |
||
| 12 | def validate(self): |
||
| 13 | check_validate = super(LoginForm, self).validate() |
||
| 14 | |||
| 15 | # if our validators do not pass |
||
| 16 | if not check_validate: |
||
| 17 | return False |
||
| 18 | |||
| 19 | # Does our the exist |
||
| 20 | user = User.query.filter_by(username=self.username.data).first() |
||
| 21 | if not user: |
||
| 22 | self.username.errors.append('Invalid username or password') |
||
| 23 | return False |
||
| 24 | |||
| 25 | # Do the passwords match |
||
| 26 | if not user.check_password(self.password.data): |
||
| 27 | self.username.errors.append('Invalid username or password') |
||
| 28 | return False |
||
| 29 | |||
| 30 | return True |
||
| 31 |