Skip to content

Commit

Permalink
Fix: Redirect to login page when reauth parameter is present and user…
Browse files Browse the repository at this point in the history
… is logged in

- Added check for 'reauth' parameter in the URL.
- Redirect to the login page if the user is already logged in.
  • Loading branch information
SH4LIN committed Jan 27, 2025
1 parent 0f0e5ca commit 9fb22a1
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions login-with-google.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,14 @@ function container(): Container {
function plugin(): Plugin {
static $plugin;

$reauth = filter_input( INPUT_GET, 'reauth', FILTER_SANITIZE_STRING );
if ( null !== $reauth ) {
if ( ! empty( $_COOKIE[ LOGGED_IN_COOKIE ] ) ) {
wp_safe_redirect( wp_login_url() );
exit;
}
}

if ( null !== $plugin ) {
return $plugin;
}
Expand Down

1 comment on commit 9fb22a1

@samorchard
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FILTER_SANITIZE_STRING is deprecated in PHP 8.1 - this has introduced a bug which prevents WP login unless PHP notices are suppressed.

Please sign in to comment.