findUserByToken() public method

Finds a user for a given password-reset-token.
public findUserByToken ( string $token ) : Symfony\Component\Security\Core\User\UserInterface
$token string the reset-token
return Symfony\Component\Security\Core\User\UserInterface
 /**
  * @return string a unique token
  */
 protected function getUniqueToken()
 {
     $token = $this->tokenGenerator->generateToken();
     try {
         $user = $this->userRepository->findUserByToken($token);
         if (!$user) {
             return $token;
         }
     } catch (NoResultException $ex) {
         return $token;
     }
     return $this->getUniqueToken();
 }
 /**
  * {@inheritdoc}
  */
 public function handle(Form $form, $webSpaceKey, array $options = [])
 {
     $data = $form->getData();
     try {
         $user = $this->userRepository->findUserByToken($data['token']);
     } catch (NoResultException $e) {
         return;
     }
     if ($user instanceof BaseUser) {
         $this->setPasswordAndSalt($form, $user);
         $user->setPasswordResetTokenExpiresAt(null);
         $user->setPasswordResetToken(null);
         if ($options[Configuration::ACTIVATE_USER]) {
             $user->setEnabled(true);
         }
         $this->entityManager->persist($user);
         $this->entityManager->flush();
     }
     return $user;
 }