Ejemplo n.º 1
0
 public function execute()
 {
     if ($this->photo->isValid()) {
         $name = sha1($this->user->getId() . $this->user->getLogin() . $this->user->getRegisteredAt() . time() . uniqid('ffdf'));
         $photoUploader = new PhotoFormatter($this->photo->getRealPath(), self::MINIMUM_SIZE, self::MAXIMUM_SIZE, $this->output);
         $old = $this->user->getAvatar();
         $photoUploader->setNewName($name);
         $photoUploader->loadAndScale(self::START_SIZE);
         $this->user->setAvatar($name);
         $this->repository->update($this->user);
         if (!empty($old)) {
             $photoUploader->removeOld($old, self::START_SIZE);
         }
     }
 }
Ejemplo n.º 2
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));
 }
Ejemplo n.º 3
0
 public function execute()
 {
     $changeRequest = CredentialChangeRequest::forEmail($this->user, $this->email, $_SERVER['REMOTE_ADDR'], time());
     $this->repository->insertCredentialChangeRequest($changeRequest);
     $this->dispatcher->dispatch(CantigaEvents::USER_CREDENTIAL_CHANGE, new CredentialChangeEvent($changeRequest));
 }