From 131e36b2d7f96c5fb3a9b9f1600eb03376a05d4d Mon Sep 17 00:00:00 2001 From: Tim Nolte Date: Tue, 12 Jan 2021 23:54:49 -0500 Subject: [PATCH] Logout Redirect URL Handling for Auto Login Setting & TravisCI Matrix Build Changes (#261) - Fixes #260 by changing conditional check for logout redirect URL handling for Auto Login setting. - Limits TravisCI matrix builds for pull requests & feature/fix branches. --- .travis.yml | 4 ++++ changelog.md | 1 + includes/openid-connect-generic-client-wrapper.php | 5 +++-- readme.txt | 1 + 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 19aa3f3..6b65819 100644 --- a/.travis.yml +++ b/.travis.yml @@ -51,15 +51,19 @@ matrix: php: 7.3 env: WP_MODE=single WP_VERSION=5.6.* PHP_UNIT=1 - name: Preferred Minimum requirements + if: (branch IN (dev, main) OR branch =~ /^dev\-release\/.*$/) AND NOT type = pull_request php: 7.2 env: WP_MODE=single WP_VERSION=5.4.* PHP_UNIT=1 - name: Minimum requirements + if: (branch IN (dev, main) OR branch =~ /^dev\-release\/.*$/) AND NOT type = pull_request php: 7.1 env: WP_MODE=single WP_VERSION=5.3.* PHP_UNIT=1 - name: Bleeding Edge + if: (branch IN (dev, main) OR branch =~ /^dev\-release\/.*$/) AND NOT type = pull_request php: 7.4 env: WP_MODE=single WP_VERSION=dev-master PHP_UNIT=1 - name: Multisite Compatibility + if: (branch IN (dev, main) OR branch =~ /^dev\-release\/.*$/) AND NOT type = pull_request php: 7.3 env: WP_MODE=multi WP_VERSION=5.6.* PHP_UNIT=1 allow_failures: diff --git a/changelog.md b/changelog.md index b045ee2..26520fa 100644 --- a/changelog.md +++ b/changelog.md @@ -4,6 +4,7 @@ * Fix: @timnolte - Prevent SSO redirect on password protected posts. * Fix: @timnolte - CI/CD build issues. +* Fix: @timnolte - Invalid redirect handling on logout for Auto Login setting. 3.8.0 diff --git a/includes/openid-connect-generic-client-wrapper.php b/includes/openid-connect-generic-client-wrapper.php index a407003..737c575 100644 --- a/includes/openid-connect-generic-client-wrapper.php +++ b/includes/openid-connect-generic-client-wrapper.php @@ -278,8 +278,9 @@ class OpenID_Connect_Generic_Client_Wrapper { $url .= $query ? '&' : '?'; // Prevent redirect back to the IDP when logging out in auto mode. - if ( 'auto' === $this->settings->login_type && 'wp-login.php?loggedout=true' === $redirect_url ) { - $redirect_url = ''; + if ( 'auto' === $this->settings->login_type && strpos( $redirect_url, 'wp-login.php?loggedout=true' ) ) { + // By default redirect back to the site home. + $redirect_url = home_url(); } $token_response = $user->get( 'openid-connect-generic-last-token-response' ); diff --git a/readme.txt b/readme.txt index b73b3be..fb72faf 100644 --- a/readme.txt +++ b/readme.txt @@ -55,6 +55,7 @@ On the settings page for this plugin (Dashboard > Settings > OpenID Connect Gene * Fix: @timnolte - Prevent SSO redirect on password protected posts. * Fix: @timnolte - CI/CD build issues. +* Fix: @timnolte - Invalid redirect handling on logout for Auto Login setting. = 3.8.0 =