/**
  * @param string $token
  */
 public function activateAccountAction($token)
 {
     /* @var $registrationFlow \Sandstorm\UserManagement\Domain\Model\RegistrationFlow */
     $registrationFlow = $this->registrationFlowRepository->findOneByActivationToken($token);
     if (!$registrationFlow) {
         $this->view->assign('tokenNotFound', true);
         return;
     }
     if (!$registrationFlow->hasValidActivationToken()) {
         $this->view->assign('tokenTimeout', true);
         return;
     }
     $this->userCreationService->createUserAndAccount($registrationFlow);
     $this->registrationFlowRepository->remove($registrationFlow);
     $this->persistenceManager->whitelistObject($registrationFlow);
     $this->view->assign('success', true);
 }
 /**
  * @param string $username The username identifying a pending registration flow.
  */
 public function activateRegistrationCommand($username)
 {
     /* @var $registrationFlow \Sandstorm\UserManagement\Domain\Model\RegistrationFlow */
     $registrationFlow = $this->registrationFlowRepository->findOneByEmail($username);
     if ($registrationFlow === null) {
         $this->outputLine('The user <b>' . $username . '</b> doesn\'t have a non-activated account.');
         $this->quit(1);
     }
     $this->userCreationService->createUserAndAccount($registrationFlow);
     $this->registrationFlowRepository->remove($registrationFlow);
 }