src/Auth.php
public function update_token($username) {
        $token = self::hash();

        $query = sprintf(self::UPDATE_VALUE,
            $this->params['table'],
            $this->params['token'],
            $this->pdo->quote($token),
            $this->params['username'],
            $this->pdo->quote($username));

        $stmt = $this->pdo->query($query);

        if($stmt === FALSE || $stmt->rowCount() !== 1) {
            throw new UserException('Token not found');
        }

        return $token;
    }
public function update_token($username) {
        $token = self::hash();

        $query = sprintf(self::UPDATE_VALUE,
            $this->params['table'],
            $this->params['token'],
            $this->pdo->quote($token),
            $this->params['username'],
            $this->pdo->quote($username));

        $stmt = $this->pdo->query($query);

        if($stmt === FALSE || $stmt->rowCount() !== 1) {
            throw new UserException('Token not found');
        }

        return $token;
    }
public function update_token ( $ username ) { $ token = self :: hash ( ) ; $ query = sprintf ( self :: UPDATE_VALUE , $ this -> params [ 'table' ] , $ this -> params [ 'token' ] , $ this -> pdo -> quote ( $ token ) , $ this -> params [ 'username' ] , $ this -> pdo -> quote ( $ username ) ) ; $ stmt = $ this -> pdo -> query ( $ query ) ; if ( $ stmt === FALSE || $ stmt -> rowCount ( ) !== 1 ) { throw new UserException ( 'Token not found' ) ; } return $ token ; }
Generates a new token for the user and update the database
@param $username
@return string new token
Generates a new token for the user and update the database