view->headTitle()->append('Connexion'); $form = new Form_Login(); $this->view->form = $form; $request = $this->getRequest(); if ($request->isPost()) { $formData = $request->getPost (); if ($form->isValid($formData)) { $login = $form->getValue('login'); $pass = $form->getValue('pass'); $auth = Zend_Auth::getInstance(); $authAdapter = new Scores_AuthAdapter($login, md5($login.'|'.$pass)); $result = $auth->authenticate($authAdapter); if (!$result->isValid()){ $this->view->message = ''; Zend_Registry::get('firebug')->info($result); foreach ($result->getMessages() as $message) { $this->view->message.= $message."
"; } } else { $url = ''; if (Zend_Session::namespaceIsset('login')){ $session = new Zend_Session_Namespace('login'); if (isset($session->url)) { $url = $session->url; } } if (!empty($url) && $url!='/user/login' && $url!='/localauth'){ $this->_redirect($url); } $this->_redirect('/'); } } } $this->_helper->layout()->disableLayout(); $this->render('login'); } /** * Gestion de la déconnexion */ public function logoutAction() { Zend_Auth::getInstance()->clearIdentity(); $this->_helper->layout()->disableLayout(); $request = $this->getRequest(); $message = $request->getParam('message'); $this->view->assign('message', $message); $url = 'http://'.$_SERVER['SERVER_NAME'].$this->view->url(array( 'controller' => 'user', 'action' => 'login', )); $this->view->assign('url', $url); $this->view->headMeta()->appendHttpEquiv('refresh', '5; url='.$url); $this->render('logout'); } }