예제 #1
0
 def is_login_valid(cls, email: str, password: str) -> bool:
     user = cls.find_by_email(email)
     if not check_hashed_password(password=password,
                                  hashed_password=user.password):
         raise UserErrors.IncorrectPasswordError(
             'Your password is incorrect')
     return True
예제 #2
0
    def is_login_valid(cls, email: str, password: str) -> bool:
        user = cls.find_by_email(email)

        if not Utils.check_hashed_password(password, user.password):
            raise UserErrors.IncorrectPasswordError('Incorrect Password.')

        return True
예제 #3
0
    def is_login_valid(cls, email: str, password: str) -> bool:
        """
        Verifies the email and password provided for a :class:`.User`.

        Parameters
        ----------
        email : str
            The email to be verified.
        password : str
            The password to be verified.

        Returns
        -------
        bool
            True if the email and password is valid, False otherwise.

        Raises
        ------
        UserErrors.IncorrectPasswordError
            If an incorrect password was provided.

        """
        user = cls.find_by_email(email)

        if not Utils.check_hashed_password(password, user.password):
            raise UserErrors.IncorrectPasswordError(
                'Your password was incorrect')

        return True
예제 #4
0
    def is_login_valid(cls, email: str, password: str) -> bool:
        # check if user exists -- if so, continue
        user = cls.find_by_email(email)

        # check if the encrypted/ hashed passwords match -- if not, give message that password was incorrect
        if not Utils.check_hashed_password(password, user.password):
            raise UserErrors.IncorrectPasswordError('Your password was incorrect.')

        return True
예제 #5
0
 def is_login_valid(cls, email: str, password: str) -> bool:
     user = cls.find_by_email(email)
     if not Utils.check_hashed_password(
             password,
             user.val()
         ['password']):  #XXX: not sure what object user will be
         raise errors.IncorrectPasswordError(
             'The password entered was incorrect.')
     return True
예제 #6
0
    def is_login_valid(cls, email: str, password: str) -> bool:
        user = cls.find_by_email(
            email)  # if not found this will produce an error from endpoint

        if not Utils.check_hashed_password(password, user.password):
            raise UserErrors.IncorrectPasswordError(
                'The password entered is incorrect.')

        return True
예제 #7
0
    def is_login_valid(cls, email: str, password: str) -> bool:
        user = cls.find_by_email(email)

        # Note - do not catch exception when user not found
        # let error get passed back to the login_user view
        if not Utils.check_hashed_password(password, user.password):
            raise UserErrors.IncorrectPasswordError(
                'The password entered was incorrect')

        return True
예제 #8
0
    def is_login_valid(cls, username: str, password: str) -> bool:
        """
        Verify the login is valid.
        """
        user = cls.find_by_username(username=username)

        if not Utils.check_hashed_password(password, user.password):
            raise errors.IncorrectPasswordError(
                'The password you have entered is incorrect.')
        return True
예제 #9
0
    def is_login_valid(cls, email: str, password: str) -> bool:
        """
        This method verifies that an e-mail/password combo (as sent by the site forms) is valid or not.
        Checks that the e-mail exists, and that the password associated to that e-mail is correct.
        :param email: The user's email
        :param password: The password
        :return: True if valid, an exception otherwise
        """
        user = cls.find_by_email(email)

        if not Utils.check_hashed_password(password, user.password):
            raise UserErrors.IncorrectPasswordError("Your password was wrong.")

        return True
예제 #10
0
 def is_login_valid(cls, email, password):
     user = cls.find_by_email(email)
     for users in user:
         if not Utils.check_hashed_password(password, users.password):
             raise UserErrors.IncorrectPasswordError('The email id or password is incorrect')
     return True