def validate(self): rv = Form.validate(self) if not rv: return False user = User.query.filter_by(username=self.username.data).first() if user is None: self.username.errors.append('Unknown username') return False if not user.check_password(self.password.data): self.password.errors.append('Invalid password') return False self.user = user return True
def validate(self): rv = Form.validate(self) if not rv: return False user = User.query.filter_by(username=self.username.data).first() if user is None: self.username.errors.append("Unknown username") return False if not user.check_password(self.password.data): self.password.errors.append("Invalid password") return False self.user = user return True
def __init__(self, *args, **kwargs): Form.__init__(self, *args, **kwargs) self.user = None