예제 #1
0
 /**
  * action create
  *
  * @param \In2\Femanager\Domain\Model\User $user
  * @validate $user In2\Femanager\Domain\Validator\ServersideValidator
  * @validate $user In2\Femanager\Domain\Validator\PasswordValidator
  * @validate $user In2\Femanager\Domain\Validator\CaptchaValidator
  * @return void
  */
 public function createAction(User $user)
 {
     $user = $this->div->overrideUserGroup($user, $this->settings);
     $user = $this->div->forceValues($user, $this->config['new.']['forceValues.']['beforeAnyConfirmation.'], $this->cObj);
     $user = $this->div->fallbackUsernameAndPassword($user);
     if ($this->settings['new']['fillEmailWithUsername'] == 1) {
         $user->setEmail($user->getUsername());
     }
     Div::hashPassword($user, $this->settings['new']['misc']['passwordSave']);
     $this->signalSlotDispatcher->dispatch(__CLASS__, __FUNCTION__ . 'BeforePersist', array($user, $this));
     if (!empty($this->settings['new']['confirmByUser']) || !empty($this->settings['new']['confirmByAdmin'])) {
         $this->createRequest($user);
     } else {
         $this->createAllConfirmed($user);
     }
 }
예제 #2
0
 /**
  * action update
  *
  * @param \In2\Femanager\Domain\Model\User $user
  * @validate $user In2\Femanager\Domain\Validator\ServersideValidator
  * @validate $user In2\Femanager\Domain\Validator\PasswordValidator
  * @return void
  */
 public function updateAction($user)
 {
     $this->addFlashMessage(LocalizationUtility::translate('createAndInvitedFinished', 'femanager'));
     $this->div->log(LocalizationUtility::translate('tx_femanager_domain_model_log.state.405', 'femanager'), 401, $user);
     // send notify email to admin
     if ($this->settings['invitation']['notifyAdmin']) {
         $this->sendMail->send('invitationNotify', Div::makeEmailArray($this->settings['invitation']['notifyAdmin'], $this->settings['invitation']['email']['invitationAdminNotify']['receiver']['name']['value']), Div::makeEmailArray($user->getEmail(), $user->getUsername()), 'Profile creation with invitation - Final', array('user' => $user, 'settings' => $this->settings), $this->config['invitation.']['email.']['invitationAdminNotify.']);
     }
     $user = $this->div->overrideUserGroup($user, $this->settings, 'invitation');
     Div::hashPassword($user, $this->settings['invitation']['misc']['passwordSave']);
     $this->userRepository->update($user);
     $this->persistenceManager->persistAll();
     // add signal after user generation
     $this->signalSlotDispatcher->dispatch(__CLASS__, __FUNCTION__ . 'AfterPersist', array($user, $this));
     $this->redirectByAction('invitation', 'redirectPasswordChanged');
     $this->redirect('status');
 }
예제 #3
0
 /**
  * action update
  *
  * @param \In2\Femanager\Domain\Model\User $user
  * @validate $user In2\Femanager\Domain\Validator\ServersideValidator
  * @validate $user In2\Femanager\Domain\Validator\PasswordValidator
  * @validate $user In2\Femanager\Domain\Validator\CaptchaValidator
  * @return void
  */
 public function updateAction(User $user)
 {
     // check if there are no changes
     if (!Div::isDirtyObject($user)) {
         $this->flashMessageContainer->add(LocalizationUtility::translate('noChanges', 'femanager'), '', \TYPO3\CMS\Core\Messaging\FlashMessage::NOTICE);
         $this->redirect('edit');
     }
     // overwrite values from TypoScript
     $user = $this->div->forceValues($user, $this->config['edit.']['forceValues.']['beforeAnyConfirmation.'], $this->cObj);
     if ($this->settings['edit']['fillEmailWithUsername'] == 1) {
         $user->setEmail($user->getUsername());
     }
     // convert password to md5 or sha1 hash
     if (array_key_exists('password', Div::getDirtyPropertiesFromObject($user))) {
         Div::hashPassword($user, $this->settings['edit']['misc']['passwordSave']);
     }
     $this->signalSlotDispatcher->dispatch(__CLASS__, __FUNCTION__ . 'BeforePersist', array($user, $this));
     if (!empty($this->settings['edit']['confirmByAdmin'])) {
         $this->updateRequest($user);
     } else {
         $this->updateAllConfirmed($user);
     }
     $this->redirect('edit');
 }