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 Nov 26, 2024
1 parent cb59085 commit 466a72f
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

0 comments on commit 466a72f

Please sign in to comment.