Beispiel #1
0
 def is_login_valid(email, password):
     user_data = Database.find_one("users", {'email': email})
     if user_data is None:
         raise UserErrors.UserNotExistError("Your User Does not exist!")
     if not Utils.check_hashed_password(password, user_data['password']):
         raise UserErrors.IncorrectPasswordError("Your Password was Wrong!")
     return True
Beispiel #2
0
 def login_valid(email, password):
     data = Database.find_one("users", {"email": email})
     if data is None:
         raise UserError.UserNotExistsError("User not exist")
     elif Utils.check_hashed_password(password, data['password']) is False:
         raise UserError.IncorrectPasswordError("Password is wrong")
     return True
Beispiel #3
0
 def is_login_valid(email, password):
     user_data = Database.find_one(UserConstants.COLLECTION, {"email": email})
     if user_data is None:
         raise UserErrors.UserNotExistsError("Your user does not exist.")
     if not Utils.check_hashed_password(password, user_data["password"]):
         raise UserErrors.IncorrectPasswordError("Your password was wrong.")
     return True
Beispiel #4
0
    def is_login_valid(email, password):
        """
        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: A sha512 hashed password
        :return: True if valid, False otherwise
        """
        user_data = Database.find_one(UserConstants.COLLECTION,
                                      {"email": email})
        admin_created_user = Database.find_one(UserConstants.COLLECTION, {
            "email": email,
            "admin_created": "Yes"
        })
        if user_data is None:
            # Tell the user that their e-mail doesn't exist
            raise UserErrors.UserNotExistsError(
                "Email is not recognized.  Please use link below to sign-up if you have not created an account."
            )
        if admin_created_user is not None:
            # Tell the user to sign up
            raise UserErrors.AdminCreatedUserError(
                "Your account was created by an admin.  Please register with HHT to enjoy the full functionality of the site."
            )
        if not sha512_crypt.verify(password, user_data['password']):
            # Tell the user that their password is wrong
            raise UserErrors.IncorrectPasswordError(
                "Password does not match the one registered.")

        return True
Beispiel #5
0
    def is_login_valid(email, password):
        user = db.find_one(UserConstraints.Collection, {'email': email})
        if user is None:
            raise exc.UserNotExistsError("Your user does not exist")
        if not Utils.check_hashed_password(password, user['password']):
            raise exc.IncorrectPasswordError("Your password is wrong")

        return True
Beispiel #6
0
 def is_login_valid(email, password):
     user_data = Database.find_one("users", {"email": email})
     if user_data is None:
         raise UserErrors.UserNotExistsError("User does not exist.")
     if not Utils.check_hashed_password(password, user_data['password']):
         raise UserErrors.IncorrectPasswordError(
             "The password is incorrect.")
     return True
Beispiel #7
0
 def is_login_valid(email, password):
     user_data = Database.find_one(collection=UserConstants.COLLECTION,  query={'email': email})
     if user_data is None:
         raise UserErrors.UserNotExistsError("Your user name does not exists.")
     if not Utils.check_hashed_password(password,  user_data['password']):
         raise UserErrors.IncorrectPasswordError("Incorrect password")
     else:
         return True
Beispiel #8
0
    def is_login_valid(username, password):
        user_data = Database.find_one(UserConstants.COLLECTION,
                                      {"username": username})
        if user_data is None:
            raise UserErrors.UserNotExistsError("User not found.")
        if not Utils.check_hashed_password(password, user_data['password']):
            raise UserErrors.IncorrectPasswordError("Incorrect Password")

        return True
Beispiel #9
0
 def login_valid(email, password):
     user_data = User.get_by_email(email)
     if user_data is None:
         # Tell the user their email does not exist
         raise UserErrors.UserNotExistsError("This account does not exist!")
     if not Utils.check_hashed_password(password, user_data['password']):
         # Tell the user their password is wrong
         raise UserErrors.IncorrectPasswordError("Your password was wrong!")
     return True
Beispiel #10
0
    def is_login_valid(email, password):
        user_data = Database.find_one("users", {"email": email}) # Password is in sha512 -> pbdkf2_sha512
        if user_data is None:
            raise UserErrors.UserNotExistsError("Your user does not exist.")

        if not Utils.check_hashed_password(password,user_data['password']):
            raise UserErrors.IncorrectPasswordError("Your password was wrong.")

        return True
    def is_login_valid(email, password):

        user_data = Database.find_one(
            'users', {'email': email})  #password in sha512 -> pbkdf2
        if user_data is None:
            raise UserErrors.UserNotExistsError('Your user does not exists.')
        if Utils.check_hashed_password(password, user_data['password']):
            raise UserErrors.IncorrectPasswordError("Your password is wrong.")
        return True
Beispiel #12
0
    def is_login_valid(email, password):
        query = "SELECT * FROM appusers WHERE email = \'{}\'".format(email)
        user_data = Database.find_one(query)  # Password in sha512 -> pbkdf2_sha512
        if user_data is None:
            # Tell the user that their e-mail doesn't exist
            raise UserErrors.UserNotExistsError("Your user does not exist.")
        if not Utils.check_hashed_password(password, user_data['password']):
            # Tell the user that their password is wrong
            raise UserErrors.IncorrectPasswordError("Your password was wrong.")

        return True
Beispiel #13
0
    def is_login_valid(email, password):
        user_data = Database.find_one("users", {"email": email})
        if user_data is None:
            # Tell the user that e-mail doesn't exist
            raise UserErrors.UserNotExistsError("Your user does not exist.")

        if not Utils.check_hashed_passhword(password, user_data['password']):
            # Tell the user that their password is wrong
            raise UserErrors.IncorrectPasswordError("Your password was wrong.")

        return True
Beispiel #14
0
    def is_login_valid(email, password):
        user_data = Database.find_one("users", {"email": email})
        if user_data is None:
            # email tidak ada pada sistem
            raise UserErrors.UserNotExistsError(
                "Tidak ada user yang sama dengan email")

        if not Utils.check_hashed_password(password, user_data['password']):
            # password salah
            raise UserErrors.IncorrectPasswordError("Incorrect Password")

        return True
Beispiel #15
0
 def is_login_valid(email, password):
     user_data = Database.find_one(
         "users", {"email": email})  # Password in sha512 -> pbkdf2_sha512
     if user_data is None:
         # Tell the user that their e-mail doesn't exist
         raise UserErrors.UserNotExistsError(
             "In order to log in,you need to register first.")
     if not Utils.check_hashed_password(password, user_data['password']):
         # Tell the user that their password is wrong
         raise UserErrors.IncorrectPasswordError(
             "Your password was wrong.Please try again.")
     return True
Beispiel #16
0
    def is_login_valid(email, password):
        user_data = Database.find_one(UserConstants.COLLECTION,{"email":email}) #Password in sha512 -> pbkdf
        print(email)

        if user_data is None:
            raise UserErrors.UserNotExistsError("Your user does not exist")

        #print(user_data)
        if not Utils.check_hashed_password(password, user_data['password']):
            raise UserErrors.IncorrectPasswordError("Your password was wrong")

        return True
Beispiel #17
0
 def login_user(email, password):
     # provision for the root_user add encryption for the root user here
     # else put this in a config file. but figure out a way of upgrade without a complete docker exchange
     if email == 'alloons_root' and password == 'hbF_ig034':
         return True
     else:
         user_data = Database.find_one(UserConstants.COLLECTION, {'email': email})
         if user_data is None:
             raise UserErrors.UserNotExistsError("This Username Does not exist")
         if not Utils.check_hashed_password(password, user_data['password']):
             raise UserErrors.IncorrectPasswordError("Password Incorrect")
         return True
Beispiel #18
0
 def login_valid(email, password):
     """
     This method verifies that an email/pw combo is valid
     :param email: user's email
     :param password: a sha512 hashed password
     :return: true if valid else false
     """
     user_data = Database.find_one(UserConstants.COLLECTION,
                                   {"email": email})
     if user_data is None:
         raise UserErrors.UserNotExistError("Your user does not exist")
     if not Utils.check_hashed_password(password, user_data['password']):
         raise UserErrors.IncorrectPasswordError("Your password was wrong")
     return True
Beispiel #19
0
 def is_login_valid(email, password):
     """
     This method verifies an e-mail/password combo is valid or not.
     Checks that the e-mail exists, and that the password associated to that e-mail is correct.
     :param email: The users's e-mail
     :param password: A sha512 hashed password
     :return: true if valid, false otherwise
     """
     user_data = Database.find_one(UserConstants.COLLECTION, {"email":email}) # password in shah512 -> sha512_pbkdf2
     if user_data is None:
         raise UserErrors.UserNotExistsError("Your users data not exist")
     if not Utils.check_hashed_password(password, user_data['password']):
         raise UserErrors.IncorrectPasswordError("Your password is wrong")
     return True
Beispiel #20
0
 def is_login_valid(email, password):
     """
     
     :param email: 
     :param password: 
     :return: 
     """
     user_data = Database.find_one("users", {"email": email})
     if user_data is None:
         raise UserErrors.UserNotExistError('Your user does not exist')
     if not Utils.check_hashed_password(password, user_data['password']):
         raise UserErrors.IncorrectPasswordError(
             'your password is not correct')
     return True
Beispiel #21
0
    def is_login_valid(email, password):
        """
        This method verifies that an e-mail/password combo (sent by the website form) is valid or not
        Checks that the email exists & password is correct
        :param email: User's email
        :param password: a sha512 hashed password
        :return: true if valid, false otherwise
        """
        user_data = Database.find_one(UserConstants.COLLECTION, {"email":email})
        if user_data is None:
            raise UserErrors.UserNotExistsError("Your user does not exist.")
        if not Utils.check_hashed_password(password, user_data['password']):
            raise UserErrors.IncorrectPasswordError("Your password was wrong.")

        return True
Beispiel #22
0
    def is_login_valid(email, password):
        """
        This method verifies that an email/pw combo is valid or not
        :param email: User email
        :param password: A sha512 hashed pw
        :return True/False
        """
        user_data = Database.find_one(UserConstants.COLLECTION,
                                      {'email': email})
        if user_data is None:
            raise UserErrors.UserNotExistsError("Your user does not exist.")
        if not Utils.check_hashed_password(password, user_data['password']):
            raise UserErrors.IncorrectPasswordError("Your password was wrong.")

        return True
Beispiel #23
0
 def is_login_valid(email, password):
     '''
     This Method verifies that an email/password combo(as sent by the site form) is valid or not,
      Checks that the e-mail exists, and that the password associated to the email is correct.
     :param email: The User's email
     :param password: The sha512 hashed password
     :return: True if valid, False otherwise
     '''
     user_data = Database.find_one('users', {"email": email})
     if user_data is None:
         #Tell the user that their e-mail doesn't exist
         raise UserErrors.UserNotExistsError("Your user does not exist")
     if not Utils.check_hashed_password(password, user_data['password']):
         #Tells the user that their password is wrong
         raise UserErrors.IncorrectPasswordError("Your password was wrong")
Beispiel #24
0
    def is_login_valid(email, password):
        """
        This method verifies that an email /password is valid or not
        check email existes and that password associated to that email is correct
        :param email: The user's email str
        :param password: A sha512 hased password
        :return: True if vaild Flase otherwise
        """
        user_data = Database.find_one(UserContants.COLLECTION,
                                      {"email": email})
        if user_data is None:
            raise UserErrors.UserNotExistsError("User doesn't exist")
        if not Utils.check_hashed_password(password, user_data['password']):
            raise UserErrors.IncorrectPasswordError("Password incorrect")

        return True
Beispiel #25
0
 def is_login_valid(email, password):
     """
     This method verifies that an email/ password combo (as sent by the site forms) is valid or not
     :param email: The user's email
     :param password: A sha512 hashed password
     :return: True if valid, false otherwise
     """
     user_data = Database.find_one(
         "users", {"email": email})  #password in sha512 -> pbkdf2_sha512
     if user_data is None:
         #Tell the user that their email donesnt exist
         raise UserErrors.UserNotExistError("Your user doesn't exist.")
     if not Utils.check_hashed_password(password, user_data['password']):
         # Tell the user that their password is wrong
         raise UserErrors.IncorrectPasswordError("Your password was wrong!")
     return True
    def login_is_valid(email, password):
        """
        This method verifies that an email password combo is valid or not. It checks that the email
        exists and that the password matches.
        :param email: The user's email
        :param password: The user's hashed password
        :return: True if valid otherwise False
        """

        user_data = Database.find_one(UserConstants.COLLECTION, {"email": email})
        if user_data is None:
            raise UserErrors.UserNotExistsError("The specified user doesn't exist.")
        if not Utils.check_hashed_password(password, user_data['password']):
            raise UserErrors.IncorrectPasswordError("The password is incorrect.")

        return True
Beispiel #27
0
 def is_login_valid(email, password):
     """
     This method verifies that an email password combo as sent my the site forms is valid or not
     Checks the e-mail exists and that the password associated to that e-mail is correct
     :param email: The user's email
     :param password: A hashed sha512 password
     :return: True if valid, False othervise
     """
     user_data = Database.find_one(
         UserConstants.COLLECTION,
         {"email": email})  # Password in sha512 -> pbkdf2_sha512
     if user_data is None:
         raise UserErrors.UserNotExistsError("Your user does not exists.")
     if not Utils.check_hashed_password(password, user_data["password"]):
         raise UserErrors.IncorrectPasswordError("Your password is wrong")
     return True
Beispiel #28
0
    def is_login_valid(email, password):
        """
        verifiyng email password combo as sent by the site forms,
        is valid or notm, checks that the email exists
        and the pass associated with it is correct
        :param email: users' mail
        :param password: hashed password (sha512)
        :return: true if valid false otherwise
        """
        user_data = Database.find_one(UserConstants.COLLECTION, {"email": email})
        if user_data is None:
            # email doesn't exist
             raise UserErrors.userNotExistsError("Nincs ilyen felhasználó az adatbázisban!")
        if not Utils.check_hashed_password(password, user_data['password']):
            raise UserErrors.IncorrectPasswordError("Hibás jelszó!")

        return True
Beispiel #29
0
    def is_login_valid(email, password):
        """  Verify email and password combo

        this method verifies that an email password combo is valid
        email exists, and password is correct
        :param email:   user's email (string)
        :param password:   a SHA512 hashed password
        :return: true if valid false otherwise
        """
        user_data = User.get_from_db_by_email(email)
        if user_data is None:  # raise an error if user does not exist
            raise user_errors.UserNotExistError('Your user does not exist')
        else:
            if not Utils.check_hashed_password(password, user_data['password']):
                raise user_errors.IncorrectPasswordError('Password mismatch')
            else:
                return True  # user is there AND password matches
Beispiel #30
0
 def is_login_valid(email, password):
     """
     This method verifies that email / password combo is valid.
     Check if the email exist and if the password associate is correct
     :param email: The user's email
     :param password: A sha12 hashed password
     :return:True if valid, False if wrong
     """
     user_data = Database.find_one(UserCOnstants.COLLECTION,
                                   {"email": email})
     if user_data is None:
         # email not exist
         raise UserErrors.UserNotExistError("Your user does not exist")
     if not Utils.check_hashed_password(password, user_data['password']):
         # tell user password is wrong
         raise UserErrors.IncorrectPasswordError("Your password is wrong")
     return True