From 6e77abb3ca8996bfa908e9029737e26d545bb198 Mon Sep 17 00:00:00 2001 From: nate Date: Wed, 21 Mar 2007 05:55:04 +0000 Subject: [PATCH] Implementing AuthComponent::$logoutAction git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@4640 3807eeeb-6ff5-0310-8944-8be069107fe0 --- cake/libs/controller/components/auth.php | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/cake/libs/controller/components/auth.php b/cake/libs/controller/components/auth.php index 7e3ad8dca..0bd8e303c 100644 --- a/cake/libs/controller/components/auth.php +++ b/cake/libs/controller/components/auth.php @@ -117,10 +117,21 @@ class AuthComponent extends Object { * redirected back after a successful login. If this session value is not * set, the user will be redirected to the page specified in $loginRedirect. * - * @var string + * @var mixed * @access public */ var $loginRedirect = null; +/** + * The the default action to redirect to after the user is logged out. While AuthComponent does + * not handle post-logout redirection, a redirect URL will be returned from AuthComponent::logout(). + * Defaults to AuthComponent::$loginAction. + * + * @var mixed + * @access public + * @see AuthComponent::$loginAction + * @see AuthComponent::logout() + */ + var $logoutRedirect = null; /** * The type of automatic ACL validation to perform, where 'actions' validates * the controller action of the current request, 'objects' validates against @@ -304,6 +315,9 @@ class AuthComponent extends Object { if (empty($this->sessionKey)) { $this->sessionKey = 'Auth.' . $this->userModel; } + if (empty($this->logoutAction)) { + $this->logoutRedirect = $this->loginAction; + } return true; } /** @@ -481,7 +495,7 @@ class AuthComponent extends Object { $this->Session->del($this->sessionKey); $this->Session->del('Auth.redirect'); $this->_loggedIn = false; - return $this->_normalizeURL($this->loginAction); + return $this->_normalizeURL($this->logoutRedirect); } /** * Get the current user from the session.