Better logout message

This commit is contained in:
Michael RICOIS 2012-08-23 08:04:46 +00:00
parent 92e64573a8
commit 6c19d02f54
2 changed files with 16 additions and 16 deletions

View File

@ -369,22 +369,23 @@ class UserController extends Zend_Controller_Action
*/ */
public function logoutAction() public function logoutAction()
{ {
$auth = Zend_Auth::getInstance(); Zend_Auth::getInstance()->clearIdentity();
$auth->clearIdentity();
$this->_helper->layout()->disableLayout(); $this->_helper->layout()->disableLayout();
$request = $this->getRequest(); $request = $this->getRequest();
$message = $request->getParam('message'); $message = $request->getParam('message');
$this->view->assign('message', $message); $this->view->assign('message', $message);
$refresh = 5;
$url = 'http://'.$_SERVER['SERVER_NAME'].$this->view->url(array( $url = 'http://'.$_SERVER['SERVER_NAME'].$this->view->url(array(
'controller' => 'user', 'controller' => 'user',
'action' => 'login', 'action' => 'login',
)); ));
$this->view->assign('url', $url); $this->view->assign('url', $url);
$this->view->headMeta()->appendHttpEquiv('refresh', '5; url='.$url); $this->view->assign('refresh', $refresh);
$this->view->headMeta()->appendHttpEquiv('refresh', $refresh.'; url='.$url);
$this->render('logout'); $this->render('logout');
} }

View File

@ -59,15 +59,14 @@ class Application_Controller_Plugin_Auth extends Zend_Controller_Plugin_Abstract
if ( !$auth->hasIdentity() || time() > $auth->getIdentity()->time ) { if ( !$auth->hasIdentity() || time() > $auth->getIdentity()->time ) {
$auth->clearIdentity(); $auth->clearIdentity();
$storage = $auth->getStorage();
Zend_Session::namespaceUnset($storage->getNamespace());
$session = new Zend_Session_Namespace('login'); $session = new Zend_Session_Namespace('login');
$session->url = $_SERVER['REQUEST_URI']; $session->url = $_SERVER['REQUEST_URI'];
$layout = Zend_Layout::getMVCInstance(); $request->setModuleName('default')
if ( !$layout->isEnabled() ) { ->setControllerName('user')
echo "Identification incorrect ou périmé."; ->setActionName('logout');
} else {
$this->_response->setRedirect('/user/login')->sendResponse();
}
//Authentifié => on met à jour la session //Authentifié => on met à jour la session
} else { } else {