/**
  * @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);
 }
Example #2
0
 /**
  * @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;
 }
Example #3
0
 /**
  * @param array $data
  * @param UserInterface $user
  * @return bool
  */
 public function changeInGamePwd(array $data, UserInterface $user)
 {
     $user = $this->userService->getUser4Id($user->getId());
     if (!$this->isPwdChangeAllowed($data, $user, 'InGame')) {
         return false;
     }
     // check if we have to change it at web too
     if ($this->isSamePasswordOption()) {
         $user = $this->userService->setNewPasswordAtUser($user, $data['password']);
     }
     $this->gameBackendService->setUser($user, $data['password']);
     return $user;
 }
 /**
  * @return mixed
  */
 public function addEmailAction()
 {
     $code = $this->params()->fromRoute('code');
     $codeEntity = $this->userCodes->getCode4Data($code, UserCodes::TYPE_ADD_EMAIL);
     if (!$codeEntity) {
         return $this->forward()->dispatch(AuthController::class, ['action' => 'wrong-code']);
     }
     $user = $this->addEmailService->changeMail($codeEntity->getUser());
     $this->userCodes->deleteCode($codeEntity);
     $this->userService->doAuthentication($user);
     return null;
 }
 /**
  * @param $userId
  * @return bool
  */
 public function userExists($userId)
 {
     $user = $this->userService->getUser4Id($userId);
     return (bool) $user;
 }
 /**
  * @return array
  */
 public function indexAction()
 {
     /** @var \PServerCore\Entity\UserInterface $user */
     $user = $this->userService->getAuthService()->getIdentity();
     return ['user' => $user];
 }