Skip to content

Commit

Permalink
add revoked handler to splash screen init
Browse files Browse the repository at this point in the history
  • Loading branch information
aaemnnosttv committed Oct 29, 2019
1 parent 583e6c0 commit f8431a5
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions includes/Core/Admin/Screens.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
namespace Google\Site_Kit\Core\Admin;

use Google\Site_Kit\Context;
use Google\Site_Kit\Core\Authentication\Authentication;
use Google\Site_Kit\Core\Permissions\Permissions;
use Google\Site_Kit\Core\Assets\Assets;

Expand Down Expand Up @@ -307,6 +308,17 @@ private function get_screens() {

// This callback will redirect to the dashboard on successful authentication.
'initialize_callback' => function( Context $context ) {
$splash_context = filter_input( INPUT_GET, 'googlesitekit_context' );
$authentication = new Authentication( $context );

// If the user is authenticated, redirect them to the disconnect URL and then send them back here.
if ( empty( $_GET['googlesitekit_reset_session'] ) && 'revoked' === $splash_context && $authentication->is_authenticated() ) { // phpcs:ignore WordPress.Security.NonceVerification.NoNonceVerification
$authentication->disconnect();

wp_safe_redirect( add_query_arg( array( 'googlesitekit_reset_session' => 1 ) ) );
exit;
}

$notification = filter_input( INPUT_GET, 'notification' );
$error = filter_input( INPUT_GET, 'error' );

Expand Down

0 comments on commit f8431a5

Please sign in to comment.