Ejemplo n.º 1
0
 /**
  * Set a user in a remember password mode. Also rises an event
  * to hook when this happens.
  *
  * Recover url must contain these fields with these names
  *
  * @param AbstractUser $user                   User
  * @param string       $recoverPasswordUrlName Recover password name
  * @param string       $hashField              Hash
  *
  * @return $this Self object
  */
 public function rememberPassword(AbstractUser $user, $recoverPasswordUrlName, $hashField = 'hash')
 {
     $recoveryHash = $this->recoveryHashGenerator->generate();
     $user->setRecoveryHash($recoveryHash);
     $this->manager->flush($user);
     $recoverUrl = $this->router->generate($recoverPasswordUrlName, [$hashField => $recoveryHash], true);
     $this->passwordEventDispatcher->dispatchOnPasswordRememberEvent($user, $recoverUrl);
     return $this;
 }
Ejemplo n.º 2
0
 /**
  * Set a user in a remember password mode. Also rises an event
  * to hook when this happens.
  *
  * Recover url must contain these fields with these names
  *
  * @param AbstractUser $user                   User
  * @param string       $recoverPasswordUrlName Recover password name
  * @param string       $hashField              Hash
  *
  * @return $this self Object
  */
 public function rememberPassword(AbstractUser $user, $recoverPasswordUrlName, $hashField = 'hash')
 {
     $recoveryHash = $this->recoveryHashGenerator->generate();
     $user->setRecoveryHash($recoveryHash);
     $this->manager->flush($user);
     $recoverUrl = $this->router->generate($recoverPasswordUrlName, array($hashField => $recoveryHash), true);
     $event = new PasswordRememberEvent($user, $recoverUrl);
     $this->eventDispatcher->dispatch(ElcodiUserEvents::PASSWORD_REMEMBER, $event);
     return $this;
 }