Making WordPress.org

Changeset 11101


Ignore:
Timestamp:
07/07/2021 04:51:52 AM (4 years ago)
Author:
dd32
Message:

Theme Directory: Trac: Pass a valid logged in cookie with Trac requests, in addition to the Authorization header.

See https://wordpress.slack.com/archives/C02RP4Y3K/p1625621326171000

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/theme-directory/lib/class-trac.php

    r6271 r11101  
    4141
    4242        $this->rpc->headers['Authorization'] = $http_basic_auth;
     43
     44        // themes.trac requires both the Authorization header and the logged in Cookie.
     45        $user = get_user_by( 'login', $username );
     46        if ( $user ) {
     47            $this->rpc->headers['Cookie'] = LOGGED_IN_COOKIE . '=' . wp_generate_auth_cookie( $user->ID, time() + MINUTE_IN_SECONDS, 'logged_in' );
     48        }
     49
    4350    }
    4451
Note: See TracChangeset for help on using the changeset viewer.