Пример #1
0
 /**
  * Recovers a password given a user
  *
  * @param AbstractUser $user        User
  * @param string       $hash        Hash given by provider
  * @param string       $newPassword New password
  *
  * @return $this Self object
  */
 public function recoverPassword(AbstractUser $user, $hash, $newPassword)
 {
     if ($hash == $user->getRecoveryHash()) {
         $user->setPassword($newPassword)->setRecoveryHash(null);
         $this->manager->flush($user);
         $this->passwordEventDispatcher->dispatchOnPasswordRecoverEvent($user);
     }
     return $this;
 }
Пример #2
0
 /**
  * Recovers a password given a user
  *
  * @param AbstractUser $user        User
  * @param string       $hash        Hash given by provider
  * @param string       $newPassword New password
  *
  * @return $this
  */
 public function recoverPassword(AbstractUser $user, $hash, $newPassword)
 {
     if ($hash == $user->getRecoveryHash()) {
         $user->setPassword($newPassword)->setRecoveryHash(null);
         $this->manager->flush($user);
         $event = new PasswordRecoverEvent($user);
         $this->eventDispatcher->dispatch(ElcodiUserEvents::PASSWORD_RECOVER, $event);
     }
     return $this;
 }