X-Git-Url: https://dev.renevier.net/?a=blobdiff_plain;f=application%2Fcontrollers%2FLoginController.php;h=4c8aca05771e224d0ed73629fab566998d589d2b;hb=482c3abbceb9818ee12c355c5d96d15077c04736;hp=ed1514f1ec85ce1b776802b07a55fc8c8f63e1e8;hpb=5fe9a5fef61308515cd1913f0bb7cc4a4ecf0253;p=syj.git diff --git a/application/controllers/LoginController.php b/application/controllers/LoginController.php index ed1514f..4c8aca0 100644 --- a/application/controllers/LoginController.php +++ b/application/controllers/LoginController.php @@ -1,16 +1,15 @@ 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'); - $this->view->headLink()->appendStylesheet('css/login.css'); + $this->_helper->SyjMedias->addScripts('login'); + $this->view->headLink()->appendStylesheet('css/generic.css', 'all'); + $this->view->headLink()->appendStylesheet('css/form.css', 'all'); + $this->view->headLink()->appendStylesheet('css/login.css', 'all'); } public function loginAction() { @@ -33,15 +32,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 +43,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); @@ -76,7 +67,7 @@ class LoginController extends Zend_Controller_Action } public function logoutAction() { - $this->_helper->SyjSession->logout(); + $this->_helper->SyjUserManager->logout(); $this->redirect(); }