/**
  * @param \CIC\Cicregister\Domain\Model\FrontendUser $frontendUser
  * @param array $password
  * @validate $password \CIC\Cicregister\Validation\Validator\PasswordValidator
  */
 public function createAction(\CIC\Cicregister\Domain\Model\FrontendUser $frontendUser, array $password)
 {
     $frontendUser->setPassword($password[0]);
     $behaviorResponse = $this->createAndPersistUser($frontendUser);
     $results = new \stdClass();
     $results->hasErrors = false;
     switch (get_class($behaviorResponse)) {
         case 'CIC\\Cicregister\\Behaviors\\Response\\RenderAction':
             $viewObjectName = 'CIC\\Cicregister\\View\\FrontendUserJSON\\' . $behaviorResponse->getValue();
             $view = $this->objectManager->create($this->defaultViewObjectName);
             $this->setViewConfiguration($view);
             $view->setControllerContext($this->controllerContext);
             $view->assign('settings', $this->settings);
             // same with settings injection.
             $this->controllerContext->getRequest()->setFormat('html');
             $out = $view->render($behaviorResponse->getValue() . '');
             $this->controllerContext->getRequest()->setFormat('json');
             $results->html = $out;
             break;
         case 'CIC\\Cicregister\\Behaviors\\Response\\RedirectAction':
             $uriBuilder = $this->controllerContext->getUriBuilder();
             $uri = $uriBuilder->reset()->setTargetPageUid($this->settings['pids']['editView'])->setNoCache(false)->setUseCacheHash(false)->uriFor($behaviorResponse->getValue(), NULL, 'FrontendUser');
             $results->redirect = $uri;
             break;
         case 'CIC\\Cicregister\\Behaviors\\Response\\RedirectURI':
             $results->redirect = $behaviorResponse->getValue();
             break;
     }
     $this->view->assign('results', json_encode($results));
 }
 /**
  * @param \CIC\Cicregister\Domain\Model\FrontendUser $frontendUser
  * @param array $otherData
  * @param array $password
  * @validate $password \CIC\Cicregister\Validation\Validator\PasswordValidator(allowEmpty = true)
  */
 public function updateAction(\CIC\Cicregister\Domain\Model\FrontendUser $frontendUser, $otherData = array(), array $password = NULL)
 {
     if ($password != NULL && is_array($password) && $password[0] != false) {
         $frontendUser->setPassword($password[0]);
     }
     $this->decorateUser($frontendUser, 'updated');
     // emit a signal prior to saving the user.
     $this->signalSlotDispatcher->dispatch(__CLASS__, 'updateAction', array('frontendUser' => $frontendUser, $otherData));
     $this->frontendUserRepository->update($frontendUser);
     $this->flashMessageContainer->add('Your profile has been updated.');
     $this->handleBehaviorResponse($this->doBehaviors($frontendUser, 'updated', 'edit'), $frontendUser);
 }