/**
  * {@inheritdoc}
  */
 public function handle(Form $form, $webSpaceKey, array $options = [])
 {
     $data = $form->getData();
     $user = $this->userRepository->findOneBy(['confirmationKey' => $data['token']]);
     $user->setConfirmationKey(null);
     if ($options[Configuration::ACTIVATE_USER]) {
         if ($user instanceof BaseUser) {
             $user->setEnabled(true);
         }
     }
     $this->entityManager->persist($user);
     $this->entityManager->flush();
     return $user;
 }
 /**
  * @return string a unique token
  */
 protected function getUniqueToken()
 {
     $token = $this->tokenGenerator->generateToken();
     $user = $this->userRepository->findOneBy(['confirmationKey' => $token]);
     if (!$user) {
         return $token;
     }
     return $this->getUniqueToken();
 }