public function execute(PasswordRecoveryRequest $request)
 {
     $request->complete();
     $passwordBuilder = new PasswordBuilder();
     $passwordBuilder->specifyPassword($this->password);
     $passwordBuilder->processChangedPassword($this->encoderFactory->getEncoder($request->getUser()));
     $passwordBuilder->exportPasswords($request->getUser());
     $this->repository->updateRequest($request);
     $this->dispatcher->dispatch(CantigaEvents::USER_PASSWORD_RECOVERY_COMPLETED, new PasswordRecoveryEvent($request));
 }
 public function validate(ExecutionContextInterface $context)
 {
     if (!$this->acceptRules) {
         $context->buildViolation('You must accept the terms of service.')->addViolation();
         return false;
     }
     if ($this->password != $this->repeatPassword) {
         $context->buildViolation('The specified passwords are not identical!')->atPath('password')->addViolation();
         return false;
     }
     if (!PasswordBuilder::isPasswordStrongEnough($this->password)) {
         $context->buildViolation('The password must contain lowercase, uppercase letters and numbers.')->atPath('password')->addViolation();
         return false;
     }
 }
Example #3
0
 public function execute()
 {
     $passwordBuilder = new PasswordBuilder();
     $passwordBuilder->specifyPassword($this->password);
     $passwordBuilder->processChangedPassword($this->encoderFactory->getEncoder($this->user));
     $changeRequest = CredentialChangeRequest::forPassword($this->user, $passwordBuilder->getEncodedPassword(), $passwordBuilder->getSalt(), $_SERVER['REMOTE_ADDR'], time());
     $this->repository->insertCredentialChangeRequest($changeRequest);
     $this->dispatcher->dispatch(CantigaEvents::USER_CREDENTIAL_CHANGE, new CredentialChangeEvent($changeRequest));
 }