X-Git-Url: https://dev.renevier.net/?a=blobdiff_plain;f=application%2Fcontrollers%2FLoginController.php;h=152d18828a13adb44c88f5c71fe3ba58eb986b3c;hb=c06c7fd6e6f26d31abb8d7c9a9f9e3f2d5b27d5c;hp=a6c7b46707130f7a98ab13d17358913346f55254;hpb=8e7d8e39a2ee5801a2f68b95cdc0e84b55da1019;p=syj.git diff --git a/application/controllers/LoginController.php b/application/controllers/LoginController.php index a6c7b46..152d188 100644 --- a/application/controllers/LoginController.php +++ b/application/controllers/LoginController.php @@ -1,16 +1,13 @@ view->headTitle($this->view->translate("login")); - $this->view->headScript()->appendFile('js/prototype.js'); - $this->view->headScript()->appendFile('js/utils.js'); - $this->view->headScript()->appendFile('js/login.js'); - $this->view->headLink()->appendStylesheet('css/generic.css', 'all'); - $this->view->headLink()->appendStylesheet('css/login.css', 'all'); + $this->_helper->SyjMedias->addScripts('login'); + $this->_helper->SyjMedias->addStyleSheets('login'); } public function loginAction() { @@ -33,15 +30,9 @@ class LoginController extends Zend_Controller_Action } /* form has been filled */ - - $adapter = Zend_Db_Table_Abstract::getDefaultAdapter(); - $authAdapter = new Zend_Auth_Adapter_DbTable($adapter, 'users', 'pseudo', 'password'); - $authAdapter->setIdentity($formData['login_user']) - ->setCredential(sha1($formData['login_password'])); - - $auth = Zend_Auth::getInstance(); - $result = $auth->authenticate($authAdapter); - if (!$result->isValid()) { + if (!$this->_helper->SyjUserManager->validate($formData['login_user'], + sha1($formData['login_password']), + $formData['login_rememberme'])) { if ($httprequest) { throw new Syj_Exception_Forbidden(); } else { @@ -50,9 +41,7 @@ class LoginController extends Zend_Controller_Action } } - $userid = $authAdapter->getResultRowObject('id')->id; - $this->_helper->SyjSession->login($userid); - $user = $this->_helper->SyjSession->user(); + $user = $this->_helper->SyjUserManager->current(); if ($httprequest) { $api = $this->_helper->SyjApi->setCode(200); @@ -65,7 +54,7 @@ class LoginController extends Zend_Controller_Action if (!$pathMapper->find((int)$login_geom_id, $path)) { throw new Syj_Exception_Request(); } - $data['iscreator'] = ($path->creator->id === $userid); + $data['iscreator'] = ($path->creator->id === $user->id); } else { $data['iscreator'] = true; } @@ -76,7 +65,7 @@ class LoginController extends Zend_Controller_Action } public function logoutAction() { - $this->_helper->SyjSession->logout(); + $this->_helper->SyjUserManager->logout(); $this->redirect(); }