diff options
Diffstat (limited to 'plugins/Login/Login.php')
-rw-r--r-- | plugins/Login/Login.php | 43 |
1 files changed, 5 insertions, 38 deletions
diff --git a/plugins/Login/Login.php b/plugins/Login/Login.php index 0002029d82..3866cd7ba7 100644 --- a/plugins/Login/Login.php +++ b/plugins/Login/Login.php @@ -19,10 +19,11 @@ class Piwik_Login extends Piwik_Plugin public function getInformation() { $info = array( - 'description' => Piwik_Translate('Login_PluginDescription'), + 'name' => 'Login', + 'description' => 'Login Authentication plugin, reading the credentials from the config/config.inc.php file for the Super User, and from the Database for the other users. Can be easily replaced to introduce a new Authentication mechanism (OpenID, htaccess, custom Auth, etc.).', 'author' => 'Piwik', - 'author_homepage' => 'http://piwik.org/', - 'version' => Piwik_Version::VERSION, + 'homepage' => 'http://piwik.org/', + 'version' => '0.1', ); return $info; } @@ -33,7 +34,6 @@ class Piwik_Login extends Piwik_Plugin 'FrontController.initAuthenticationObject' => 'initAuthenticationObject', 'FrontController.NoAccessException' => 'noAccess', 'API.Request.authenticate' => 'ApiRequestAuthenticate', - 'Login.initSession' => 'initSession', ); return $hooks; } @@ -68,8 +68,7 @@ class Piwik_Login extends Piwik_Plugin $authCookieName = Zend_Registry::get('config')->General->login_cookie_name; $authCookieExpiry = time() + Zend_Registry::get('config')->General->login_cookie_expire; - $authCookiePath = Zend_Registry::get('config')->General->login_cookie_path; - $authCookie = new Piwik_Cookie($authCookieName, $authCookieExpiry, $authCookiePath); + $authCookie = new Piwik_Cookie($authCookieName, $authCookieExpiry); $defaultLogin = 'anonymous'; $defaultTokenAuth = 'anonymous'; if($authCookie->isCookieFound()) @@ -80,36 +79,4 @@ class Piwik_Login extends Piwik_Plugin $auth->setLogin($defaultLogin); $auth->setTokenAuth($defaultTokenAuth); } - - function initSession($notification) - { - $info = $notification->getNotificationObject(); - $login = $info['login']; - $md5Password = $info['md5Password']; - - $tokenAuth = Piwik_UsersManager_API::getInstance()->getTokenAuth($login, $md5Password); - - $auth = Zend_Registry::get('auth'); - $auth->setLogin($login); - $auth->setTokenAuth($tokenAuth); - - $authResult = $auth->authenticate(); - if(!$authResult->isValid()) - { - throw new Exception(Piwik_Translate('Login_LoginPasswordNotCorrect')); - } - - $ns = new Zend_Session_Namespace('Piwik_Login.referer'); - unset($ns->referer); - - $authCookieName = Zend_Registry::get('config')->General->login_cookie_name; - $authCookieExpiry = time() + Zend_Registry::get('config')->General->login_cookie_expire; - $authCookiePath = Zend_Registry::get('config')->General->login_cookie_path; - $cookie = new Piwik_Cookie($authCookieName, $authCookieExpiry, $authCookiePath); - $cookie->set('login', $login); - $cookie->set('token_auth', $authResult->getTokenAuth()); - $cookie->save(); - - Zend_Session::regenerateId(); - } } |