Modification condition de vérification de l'authentification

This commit is contained in:
Michael RICOIS 2011-06-30 14:04:02 +00:00
parent 5cd16adb94
commit 397ed5495f

View File

@ -9,17 +9,20 @@ class Application_Controller_Plugin_Auth extends Zend_Controller_Plugin_Abstract
*/ */
public function preDispatch(Zend_Controller_Request_Abstract $request) public function preDispatch(Zend_Controller_Request_Abstract $request)
{ {
if ($request->getControllerName()!='user' && $request->getActionName()!='login') if ($request->getActionName()!='login')
{ {
$auth = Zend_Auth::getInstance(); $auth = Zend_Auth::getInstance();
Zend_Registry::get('firebug')->info('COUCOU');
Zend_Registry::get('firebug')->info($auth->hasIdentity());
//Pas authentifié //Pas authentifié
if (!$auth->hasIdentity()) { if (!$auth->hasIdentity()) {
$auth->clearIdentity(); $auth->clearIdentity();
$session = new Zend_Session_Namespace('login'); $session = new Zend_Session_Namespace('login');
$session->url = $_SERVER['REQUEST_URI']; $session->url = $_SERVER['REQUEST_URI'];
$this->_response->setRedirect('/user/login');
$this->_response->setRedirect('/user/login')->sendResponse();
//Authentifié => on met à jour la session //Authentifié => on met à jour la session
} else { } else {