Esempio n. 1
0
 public function changePasswordAction()
 {
     $resultModel = new JsonResultModel();
     if ($this->getRequest()->isPost()) {
         try {
             $jsonData = $this->params()->fromPost('password');
             $data = Json::decode($jsonData);
             $this->accountService->changePassword($this->authenticationService->getIdentity()->getId(), $data->password, $data->newPassword);
         } catch (ValidationException $ve) {
             return $resultModel->setErrors($ve->getValidationError());
         } catch (\Exception $e) {
             return $resultModel->addErrors('error', 'unknow error');
         }
         return $resultModel;
     }
 }