diff --git a/includes/Modules/Sign_In_With_Google.php b/includes/Modules/Sign_In_With_Google.php index 7b910d923db..093d6cf8b8d 100644 --- a/includes/Modules/Sign_In_With_Google.php +++ b/includes/Modules/Sign_In_With_Google.php @@ -363,8 +363,9 @@ private function render_signinwithgoogle() { $render_buttons = $is_wp_login || $is_woocommerce_login; $render_one_tap = ! empty( $settings['oneTapEnabled'] ) && ( $is_wp_login || ! is_user_logged_in() ); - if ( empty( $redirect_to ) && ! $render_buttons && $render_one_tap && isset( $_SERVER['REQUEST_URI'] ) ) { - $redirect_to = wp_strip_all_tags( wp_unslash( $_SERVER['REQUEST_URI'] ) ); + // If we aren't rendering buttons or One-tap, return early. + if ( ! $render_buttons && ! $render_one_tap ) { + return; } // Set the cookie time to live to 5 minutes. If the redirect_to is empty, @@ -389,9 +390,14 @@ private function render_signinwithgoogle() { headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, body: new URLSearchParams( response ) } ); - if ( res.ok && res.redirected ) { - location.assign( res.url ); - } + + + location.reload(); + + if ( res.ok && res.redirected ) { + location.assign( res.url ); + } + } catch( error ) { console.error( error ); } @@ -425,9 +431,11 @@ private function render_signinwithgoogle() { google.accounts.id.prompt(); - const expires = new Date(); - expires.setTime( expires.getTime() + ); - document.cookie = "=;expires=" + expires.toUTCString() + ";path="; + + const expires = new Date(); + expires.setTime( expires.getTime() + ); + document.cookie = "=;expires=" + expires.toUTCString() + ";path="; + } )();