Skip to content

Commit

Permalink
Add Client ID to change email API call
Browse files Browse the repository at this point in the history
  • Loading branch information
joshcanhelp committed Jun 4, 2019
1 parent a396681 commit 0f3f2f1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/api/WP_Auth0_Api_Change_Email.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ public function call( $user_id = null, $email = null ) {
->add_body( 'email', $email )
// Email is either changed by an admin or verified by WP.
->add_body( 'email_verified', true )
->add_body( 'client_id', $this->options->get( 'client_id' ) )
->patch()
->handle_response( __METHOD__ );
}
Expand Down
4 changes: 4 additions & 0 deletions tests/testApiChangeEmail.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ public function testThatFailedApiReturnsFalse() {
public function testThatApiCallIsFormedCorrectly() {
$this->startHttpHalting();
self::$opts->set( 'domain', self::TEST_DOMAIN );
self::$opts->set( 'client_id', '__test_client_id__' );

// Should succeed with a user_id + provider and set_bearer returning true.
$change_email = $this->getStub( true );
Expand All @@ -86,7 +87,10 @@ public function testThatApiCallIsFormedCorrectly() {
$this->assertEquals( 'PATCH', $decoded_res['method'] );
$this->assertArrayHasKey( 'email', $decoded_res['body'] );
$this->assertEquals( '[email protected]', $decoded_res['body']['email'] );
$this->assertArrayHasKey( 'email_verified', $decoded_res['body'] );
$this->assertTrue( $decoded_res['body']['email_verified'] );
$this->assertArrayHasKey( 'client_id', $decoded_res['body'] );
$this->assertEquals( '__test_client_id__', $decoded_res['body']['client_id'] );
}

/**
Expand Down

0 comments on commit 0f3f2f1

Please sign in to comment.