Plugin Directory

Changeset 2333490


Ignore:
Timestamp:
07/01/2020 12:28:10 PM (5 years ago)
Author:
zapier
Message:

Allow for compatibility with other Zapier-powered plugins

Location:
zapier
Files:
2 edited
1 copied

Legend:

Unmodified
Added
Removed
  • zapier/tags/1.0.1/zapier.php

    r2312479 r2333490  
    130130    public function get_user_from_token()
    131131    {
    132         if (!isset($_SERVER['HTTP_X_ZAPIER_AUTH'])) {
    133             $this->error = new WP_Error(
    134                 'no_auth_header',
    135                 'X_ZAPIER_AUTH header not found.',
    136                 array(
    137                     'status' => 400,
    138                 )
    139             );
    140             return;
    141         }
    142 
    143132        try {
    144133            $token = JWT::decode(
     
    183172        $is_valid_rest_api_uri = strpos($_SERVER['REQUEST_URI'], $rest_api_slug);
    184173        $is_valid_token_uri = strpos($_SERVER['REQUEST_URI'], $this->namespace . '/token');
    185         $is_zapier_request = $_SERVER['HTTP_USER_AGENT'] === 'Zapier';
     174        $is_zapier_request = $_SERVER['HTTP_USER_AGENT'] === 'Zapier' && isset($_SERVER['HTTP_X_ZAPIER_AUTH']);
    186175
    187176        if ($is_zapier_request && $is_valid_rest_api_uri && !$is_valid_token_uri) {
  • zapier/trunk/zapier.php

    r2312479 r2333490  
    130130    public function get_user_from_token()
    131131    {
    132         if (!isset($_SERVER['HTTP_X_ZAPIER_AUTH'])) {
    133             $this->error = new WP_Error(
    134                 'no_auth_header',
    135                 'X_ZAPIER_AUTH header not found.',
    136                 array(
    137                     'status' => 400,
    138                 )
    139             );
    140             return;
    141         }
    142 
    143132        try {
    144133            $token = JWT::decode(
     
    183172        $is_valid_rest_api_uri = strpos($_SERVER['REQUEST_URI'], $rest_api_slug);
    184173        $is_valid_token_uri = strpos($_SERVER['REQUEST_URI'], $this->namespace . '/token');
    185         $is_zapier_request = $_SERVER['HTTP_USER_AGENT'] === 'Zapier';
     174        $is_zapier_request = $_SERVER['HTTP_USER_AGENT'] === 'Zapier' && isset($_SERVER['HTTP_X_ZAPIER_AUTH']);
    186175
    187176        if ($is_zapier_request && $is_valid_rest_api_uri && !$is_valid_token_uri) {
Note: See TracChangeset for help on using the changeset viewer.