X-Git-Url: https://dev.renevier.net/?p=syj.git;a=blobdiff_plain;f=application%2Fcontrollers%2FLoginController.php;h=ce9db39dd07d217e058728ccb1a0ee704bcb26b2;hp=495c27c408b38939ddc861047cd75be9ca0c5d3f;hb=70d6bb9dfa4c198607fbe75592f108bc8d69048b;hpb=a64d41557a62ec6051d7fa08d1ba941e089aa5c2 diff --git a/application/controllers/LoginController.php b/application/controllers/LoginController.php index 495c27c..ce9db39 100644 --- a/application/controllers/LoginController.php +++ b/application/controllers/LoginController.php @@ -6,11 +6,10 @@ 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/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() { @@ -52,9 +51,11 @@ class LoginController extends Zend_Controller_Action $userid = $authAdapter->getResultRowObject('id')->id; $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) { @@ -63,14 +64,11 @@ class LoginController extends Zend_Controller_Action if (!$pathMapper->find((int)$login_geom_id, $path)) { throw new Syj_Exception_Request(); } - if ($path->creator->id === $userid) { - $api->setBody("1"); // creator of displayed geometry - } else { - $api->setBody("0"); - } + $data['iscreator'] = ($path->creator->id === $userid); } else { - $api->setBody("1"); // no geometry displayed: creator of the (future) geometry + $data['iscreator'] = true; } + $api->setBodyJson($data); } else { $this->redirect(); }