X-Git-Url: https://dev.renevier.net/?a=blobdiff_plain;f=application%2Fcontrollers%2FLoginController.php;h=ed1514f1ec85ce1b776802b07a55fc8c8f63e1e8;hb=5fe9a5fef61308515cd1913f0bb7cc4a4ecf0253;hp=07bb40b874b484c90a20e239eb0b59ccf7127210;hpb=9efd079d59d269811abc4c551b2f39ab2e6a05fb;p=syj.git diff --git a/application/controllers/LoginController.php b/application/controllers/LoginController.php index 07bb40b..ed1514f 100644 --- a/application/controllers/LoginController.php +++ b/application/controllers/LoginController.php @@ -7,8 +7,7 @@ class LoginController extends Zend_Controller_Action public function init() { $this->view->headTitle($this->view->translate("login")); $this->view->headScript()->appendFile('js/prototype.js'); - $this->view->headScript()->appendFile('js/forms.js'); - $this->view->headScript()->appendFile('js/highlight.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'); @@ -52,12 +51,12 @@ class LoginController extends Zend_Controller_Action } $userid = $authAdapter->getResultRowObject('id')->id; - $auth->getStorage()->write(array('user' => $userid)); - Zend_Session::rememberMe(); // zend default expiration delay is 2 weeks. Ok, use that value - + $this->_helper->SyjSession->login($userid); + $user = $this->_helper->SyjSession->user(); if ($httprequest) { $api = $this->_helper->SyjApi->setCode(200); + $data = array('pseudo' => $user->pseudo); $login_geom_id = $formData['login_geom_id']; if ($login_geom_id) { @@ -66,22 +65,18 @@ class LoginController extends Zend_Controller_Action if (!$pathMapper->find((int)$login_geom_id, $path)) { throw new Syj_Exception_Request(); } - if ($path->owner->id === $userid) { - $api->setBody("1"); // owner of displayed geometry - } else { - $api->setBody("0"); - } + $data['iscreator'] = ($path->creator->id === $userid); } else { - $api->setBody("1"); // no geometry displayed: owner of the (future) geometry + $data['iscreator'] = true; } + $api->setBodyJson($data); } else { $this->redirect(); } } public function logoutAction() { - Zend_Session::start(); - Zend_Session::destroy(); + $this->_helper->SyjSession->logout(); $this->redirect(); }