/**
  * @param \Planetflow3\Domain\Dto\UserPassword $value
  * @return void
  */
 protected function isValid($value)
 {
     if (strlen($value->getPassword()) > 0 && strlen($value->getPassword()) < 8) {
         $this->result->forProperty('password')->addError(new \TYPO3\FLOW3\Validation\Error('Password must be at least 8 characters', 1332265186));
     }
     if ($value->getPassword() !== $value->getPasswordConfirmation()) {
         $this->result->forProperty('passwordConfirmation')->addError(new \TYPO3\FLOW3\Validation\Error('Password confirmation does not match', 1332264922));
     }
 }
Ejemplo n.º 2
0
 /**
  * Update action
  *
  * @param \Planetflow3\Domain\Model\User $user
  * @param \Planetflow3\Domain\Dto\UserPassword $userPassword
  * @FLOW3\Validate("$userPassword", type="Planetflow3\Domain\Validator\UserPasswordValidator")
  */
 public function updateAction(\Planetflow3\Domain\Model\User $user, \Planetflow3\Domain\Dto\UserPassword $userPassword)
 {
     if ((string) $userPassword->getPassword() !== '') {
         $user->setPassword($userPassword->getPassword());
     }
     $this->userRepository->update($user);
     $this->addFlashMessage('User updated.', 'Success', \TYPO3\FLOW3\Error\Message::SEVERITY_OK);
     $this->redirect('index');
 }