Skip to content

Commit

Permalink
Merge pull request #6451 from georgeh/fix/wpcom-token-check
Browse files Browse the repository at this point in the history
Change the token check to use the passed user_id
  • Loading branch information
georgeh authored Feb 28, 2017
2 parents 67b8ac3 + 2c73555 commit 87e132c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions class.jetpack-xmlrpc-server.php
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ function test_api_user_code( $args ) {
error_log( "VERIFY: $verify" );
*/

$jetpack_token = Jetpack_Data::get_access_token( JETPACK_MASTER_USER );
$jetpack_token = Jetpack_Data::get_access_token( $user_id );

$api_user_code = get_user_meta( $user_id, "jetpack_json_api_$client_id", true );
if ( !$api_user_code ) {
Expand All @@ -326,7 +326,7 @@ function test_api_user_code( $args ) {
* @return boolean
*/
function disconnect_blog() {

// For tracking
if ( ! empty( $this->user->ID ) ) {
wp_set_current_user( $this->user->ID );
Expand Down
3 changes: 2 additions & 1 deletion class.jetpack.php
Original file line number Diff line number Diff line change
Expand Up @@ -5290,7 +5290,8 @@ function verify_json_api_authorization_request( $environment = null ) {
? $_REQUEST
: $environment;

$token = Jetpack_Data::get_access_token( JETPACK_MASTER_USER );
list( $envToken, $envVersion, $envUserId ) = explode( ':', $environment['token'] );
$token = Jetpack_Data::get_access_token( $envUserId );
if ( ! $token || empty( $token->secret ) ) {
wp_die( __( 'You must connect your Jetpack plugin to WordPress.com to use this feature.' , 'jetpack' ) );
}
Expand Down

0 comments on commit 87e132c

Please sign in to comment.