/** * @return JsonModel */ public function indexAction() { $characterId = $this->params()->fromPost('characterId', 0); /** @var \PServerCore\Entity\UserInterface $user */ $user = $this->userService->getAuthService()->getIdentity(); $response = $this->unStuckService->unStuckCharacter($user, $characterId); return new JsonModel($response); }
/** * @return string */ public function __invoke() { $template = ''; if (!$this->userService->getAuthService()->hasIdentity()) { $viewModel = new ViewModel(['loginForm' => $this->userService->getLoginForm()]); $viewModel->setTemplate('helper/sidebarLoginWidget'); $template = $this->getView()->render($viewModel); } return $template; }
/** * @return array|\Zend\Http\Response */ public function registerAction() { //if already login, redirect to success page if ($this->userService->getAuthService()->hasIdentity()) { return $this->redirect()->toRoute($this->getLoggedInRoute()); } $form = $this->userService->getRegisterForm(); /** @var \Zend\Http\Request $request */ $request = $this->getRequest(); if ($request->isPost()) { $user = $this->getUserService()->register($this->params()->fromPost()); if ($user) { return $this->redirect()->toRoute('small-user-auth', ['action' => 'register-done']); } } return ['registerForm' => $form]; }
/** * @return array */ public function indexAction() { /** @var \PServerCore\Entity\UserInterface $user */ $user = $this->userService->getAuthService()->getIdentity(); return ['user' => $user]; }