/** * @return bool */ public function action_login() { $this->setJSONHeader(); if ($err = Base::createSession($_POST['email'], $_POST['password'])) { $this->response->body(json_encode(['code' => $err])); return false; } else { $this->response->body(json_encode(['code' => 0])); } }
/** * */ public function action_login() { if ($this->request->is_ajax()) { if (\HTTP_Request::POST == $this->request->method()) { $status = \Auth\Base::createSession($_POST['email'], $_POST['pass']); $this->response->body(json_encode(['code' => $status])); return true; } } else { Assets::js('login', base_UI . 'js/index/login.js'); if (\Registry::getCurrentUser()->isGuest()) { $this->response->body($this->template->fetch('admin/index/Login.tpl')); } else { \HTTP::redirect(\Route::get('SystemRoute')->uri(['controller' => 'Users', 'action' => 'Index']), 302); } } }