def update_password(self, username, new_password):
        validator = get_validator(username)
        if validator.is_valid(new_password):
            hash_password, salt = hash_password(password)

        user = self.session.query(Client).\
                filter(Client.username == username).one()
        user.password = hash_password
        user.salt = salt
        self._commit_object(user)
def register(username, password):
    validator = get_validator(username)

    if not validator.is_valid(password):
        raise StrongPasswordException(messages.STRONG_PASSWORD)

    hashed_password, salt = hash_password(password)
    insert_sql = """INSERT INTO clients (username, password, salt)
                    VALUES (?, ?, ?)"""

    cursor.execute(insert_sql, (username, hashed_password, salt))
    conn.commit()
def register(username, password):
    validator = get_validator(username)

    if not validator.is_valid(password):
        raise StrongPasswordException(messages.STRONG_PASSWORD)

    hashed_password, salt = hash_password(password)
    insert_sql = """INSERT INTO clients (username, password, salt)
                    VALUES (?, ?, ?)"""

    cursor.execute(insert_sql, (username, hashed_password, salt))
    conn.commit()
    def register(self, username, password, email):
        if self.check_user_is_in_base(username):
            raise ClientAlreadyRegistered('Client already registered')

        validator = get_validator(username)
        if validator.is_valid(password):
            self.__username = username
            self.__password = password
            self.__hash_password, self.__salt = hash_password(password)
            self.__email = email

        user = self.create_client_info()
        self._commit_object(user)
    def register(self, user, password):
        validator = get_validator(user)

        if not validator.is_valid(password):
            raise StrongPasswordException("Your password is not strong enough")

        hashed_password, salt = hash_password(password)

        current_user = self.session.query(Clients.username).\
                        filter(Clients.username == user).first()

        if current_user is not None:
            raise ClientAlreadyRegistered('Client already registered')

        client = Clients(username=user, password=hashed_password, salt=salt)
        self.__commit_object(client)
    def register(self, email, name, password):
        user = self.session.query(Client).\
                filter(Client.email == email).first()

        if user is not None:
            raise ClientAlreadyRegistered('Client already registered.')

        if not get_validator(email.split("@")[0]).is_valid(password):
            raise PasswordNotStrongError

        if not email_validation(email):
            raise EmailNotValidError

        hashed_pass, salt = hash_pass(password)

        client = Client(email=email, name=name, password=hashed_pass, salt=salt)
        self.__commit_object(client)
def register(username, password):
    if not get_validator(username).is_valid(password):
        raise PasswordNotStrongError
    else:
        insert_into_clients(username, password)