From c048a019f69d8e7b44f50576c7d1d35765b0aa58 Mon Sep 17 00:00:00 2001 From: jean Date: Thu, 9 Feb 2012 15:58:05 +1300 Subject: [PATCH] BUGFIX Avoid infinite redirection when logging out and when showing a custom login page after displaying the draft version of a page. --- security/Member.php | 5 ++++- security/Security.php | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/security/Member.php b/security/Member.php index a28d24ec6..082c221fb 100644 --- a/security/Member.php +++ b/security/Member.php @@ -421,9 +421,12 @@ class Member extends DataObject implements TemplateGlobalProvider { $this->extend('memberLoggedOut'); $this->RememberLoginToken = null; - Cookie::set('alc_enc', null); + Cookie::set('alc_enc', null); // // Clear the Remember Me cookie Cookie::forceExpiry('alc_enc'); + // Switch back to live in order to avoid infinite loops when redirecting to the login screen (if this login screen is versioned) + Session::clear('readingMode'); + $this->write(); // Audit logging hook diff --git a/security/Security.php b/security/Security.php index 9c78bd397..9bc78516f 100644 --- a/security/Security.php +++ b/security/Security.php @@ -951,7 +951,7 @@ class Security extends Controller { */ public static function set_login_url($loginUrl) { self::$login_url = $loginUrl; - } +} /** * Get the URL of the log-in page. * Defaults to Security/login but can be re-set with {@link set_login_url()}