def attempt_login(cls, email: str, password: str) -> bool: user = cls.find_by_email(email) if not Utils.check_hashed_password(password, user.password): raise CustomErrors.IncorrectPasswordError('The username or password you have entered is incorrect.') return True
def is_login_valid(cls, email, password): user = cls.find_by_email(email) if not Utils.check_hashed_password(password, user.password): raise error.IncorrectPasswordError( 'Incorrect password or email try forgot password.') return True