From 6ea7de0054c31adfd58cffab761928840a526061 Mon Sep 17 00:00:00 2001 From: Yannick Warnier Date: Thu, 9 Apr 2015 23:13:57 -0500 Subject: [PATCH] Add no_redirect GET param support to avoid sending useless params on logout - refs BT#9701 --- main/auth/sso/sso.Drupal.class.php | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/main/auth/sso/sso.Drupal.class.php b/main/auth/sso/sso.Drupal.class.php index 87f4b2f0e6..569190790d 100755 --- a/main/auth/sso/sso.Drupal.class.php +++ b/main/auth/sso/sso.Drupal.class.php @@ -52,7 +52,11 @@ class ssoDrupal */ public function logout() { - header('Location: '.$this->deauth_url); + if (empty($_GET['no_redirect'])) { + header('Location: '.$this->deauth_url); + } else { + header('Location: '.$this->protocol.$this->domain); + } exit; } @@ -64,11 +68,14 @@ class ssoDrupal // Generate a single usage token that must be encoded by the master $_SESSION['sso_challenge'] = api_generate_password(48); // Redirect browser to the master URL - $params = 'sso_referer='.urlencode($this->referer).'&sso_target='.urlencode($this->target).'&sso_challenge='.urlencode($_SESSION['sso_challenge']); - if (strpos($this->master_url, "?") === false) { - $params = "?{$params}"; - } else { - $params = "&{$params}"; + $params = ''; + if (empty($_GET['no_redirect'])) { + $params = 'sso_referer='.urlencode($this->referer).'&sso_target='.urlencode($this->target).'&sso_challenge='.urlencode($_SESSION['sso_challenge']); + if (strpos($this->master_url, "?") === false) { + $params = "?{$params}"; + } else { + $params = "&{$params}"; + } } header('Location: '.$this->master_url.$params); exit;