getCurrentUser(); if ($user->id > 0) { $this->response->redirect(['for' => 'admin.index']); } if ($this->request->isPost()) { $this->checkHttpReferer(); $this->checkCsrfToken(); $sessionService = new SessionService(); $sessionService->login(); $location = $this->url->get(['for' => 'admin.index']); return $this->jsonSuccess(['location' => $location]); } $appInfo = new AppInfo(); $settingService = new SettingService(); $captcha = $settingService->getSectionSettings('captcha'); $this->view->pick('public/login'); $this->view->setVar('app_info', $appInfo); $this->view->setVar('captcha', $captcha); } /** * @Get("/logout", name="admin.logout") */ public function logoutAction() { $sessionService = new SessionService(); $sessionService->logout(); $this->response->redirect(['for' => 'admin.login']); } }