diff options
author | robocoder <anthon.pang@gmail.com> | 2009-05-17 10:27:20 +0400 |
---|---|---|
committer | robocoder <anthon.pang@gmail.com> | 2009-05-17 10:27:20 +0400 |
commit | 1012135c0495189f5227dcb7e905f0ddfd113e66 (patch) | |
tree | 7a9ccfd1857e13950cd6a8bf909df3ddd76de325 | |
parent | 216b74c1426fcae7fdf6793a46d503aabcece27e (diff) |
fixed #551 - "Logout" / "Sign out" action linked to the active
authentication plugin.
git-svn-id: http://dev.piwik.org/svn/trunk@1131 59fd770c-687e-43c8-a1e3-f5a4ff64c105
-rw-r--r-- | core/Auth.php | 5 | ||||
-rw-r--r-- | core/Controller.php | 2 | ||||
-rw-r--r-- | core/View.php | 3 | ||||
-rw-r--r-- | plugins/CoreHome/templates/top_bar.tpl | 2 | ||||
-rw-r--r-- | plugins/Login/Auth.php | 5 |
5 files changed, 14 insertions, 3 deletions
diff --git a/core/Auth.php b/core/Auth.php index dc23bc6128..eda890e303 100644 --- a/core/Auth.php +++ b/core/Auth.php @@ -13,6 +13,11 @@ require_once "Zend/Auth/Result.php"; interface Piwik_Auth { /** + * @return string + */ + public function getName(); + + /** * @return Piwik_Auth_Result */ public function authenticate(); diff --git a/core/Controller.php b/core/Controller.php index 1c22c7b0e3..6b800ca212 100644 --- a/core/Controller.php +++ b/core/Controller.php @@ -314,7 +314,7 @@ abstract class Piwik_Controller && $currentLogin != 'anonymous') { $errorMessage = sprintf(Piwik_Translate('CoreHome_NoPrivileges'),$currentLogin); - $errorMessage .= "<br /><br /> <b><a href='?module=Login&action=logout'>› ". Piwik_Translate('General_Logout'). "</a></b><br />"; + $errorMessage .= "<br /><br /> <b><a href='?module=". Zend_Registry::get('auth')->getName() ."&action=logout'>› ". Piwik_Translate('General_Logout'). "</a></b><br />"; Piwik_ExitWithMessage($errorMessage, false, true); } else diff --git a/core/View.php b/core/View.php index 5f79e7037c..6b7c47a541 100644 --- a/core/View.php +++ b/core/View.php @@ -93,7 +93,8 @@ class Piwik_View implements Piwik_iView $this->userIsSuperUser = Piwik::isUserIsSuperUser(); $this->piwik_version = Piwik_Version::VERSION; $this->latest_version_available = Piwik_UpdateCheck::isNewestVersionAvailable(); - + + $this->loginModule = Zend_Registry::get('auth')->getName(); } catch(Exception $e) { // can fail, for example at installation (no plugin loaded yet) } diff --git a/plugins/CoreHome/templates/top_bar.tpl b/plugins/CoreHome/templates/top_bar.tpl index 3bad78778e..1bbf9cbc91 100644 --- a/plugins/CoreHome/templates/top_bar.tpl +++ b/plugins/CoreHome/templates/top_bar.tpl @@ -13,7 +13,7 @@ {'General_HelloUser'|translate:"<strong>$userLogin</strong>"} {if isset($userHasSomeAdminAccess) && $userHasSomeAdminAccess}| <a href='?module=CoreAdminHome'>{'General_Settings'|translate}</a>{/if} {if $showSitesSelection && $showWebsiteSelectorInUserInterface}| {include file=CoreHome/templates/sites_selection.tpl}{/if} -| {if $userLogin == 'anonymous'}<a href='?module=Login'>{'Login_LogIn'|translate}</a>{else}<a href='?module=Login&action=logout'>{'Login_Logout'|translate}</a>{/if} +| {if $userLogin == 'anonymous'}<a href='?module={$loginModule}'>{'Login_LogIn'|translate}</a>{else}<a href='?module={$loginModule}&action=logout'>{'Login_Logout'|translate}</a>{/if} </small> </nobr> diff --git a/plugins/Login/Auth.php b/plugins/Login/Auth.php index 61e1c67a50..a10f4d8280 100644 --- a/plugins/Login/Auth.php +++ b/plugins/Login/Auth.php @@ -8,6 +8,11 @@ class Piwik_Login_Auth implements Piwik_Auth protected $login = null; protected $token_auth = null; + public function getName() + { + return 'Login'; + } + public function authenticate() { $rootLogin = Zend_Registry::get('config')->superuser->login; |