public function confirmAction(Request $request, $token)
 {
     if ($this->userAlreadyLoggedIn()) {
         $router = $this->container->get('router');
         return new RedirectResponse($router->generate('fos_user_profile_edit'), 302);
     }
     return parent::confirmAction($request, $token);
 }
 /**
  * Receive the confirmation token from user email provider, login the user
  */
 public function confirmAction(Request $request, $token)
 {
     $userManager = $this->container->get('fos_user.user_manager');
     $user = $userManager->findUserByConfirmationToken($token);
     if (null === $user) {
         // User with token not found. Do whatever you want here
         return new RedirectResponse($this->container->get('router')->generate('fos_user_security_login'));
     } else {
         // Token found. Letting the FOSUserBundle's action handle the confirmation
         return parent::confirmAction($request, $token);
     }
 }
 public function confirmAction($token)
 {
     $return = parent::confirmAction($token);
     if ($return instanceof RedirectResponse) {
         $user = $this->container->get('security.context')->getToken()->getUser();
         if (is_object($user) || $user instanceof UserInterface) {
             $dispatcher = $this->container->get('event_dispatcher');
             $event = new ManualLoginEvent($user);
             $dispatcher->dispatch('security.manual_login', $event);
         }
     }
     return $return;
 }
예제 #4
0
 /**
  * 
  * @param Request $request
  * @param unknown $token
  */
 public function confirmAction(Request $request, $token)
 {
     $userManager = $this->container->get('fos_user.user_manager');
     $user = $userManager->findUserByConfirmationToken($token);
     if (null === $user) {
         /* ************************************
          *
          * User with token not found. Do whatever you want here
          *
          * e.g. redirect to login:
          **************************************/
         //return $this->container->get('templating')->renderResponse('DriveHomeBundle:Registration:link_error.html.twig');
         return $this->render('TripSecurityBundle:Registration:link_error.html.twig');
     } else {
         // Token found. Letting the FOSUserBundle's action handle the confirmation
         return parent::confirmAction($request, $token);
     }
 }
 /**
  * @ApiDoc(
  *  resource=false,
  *  section="Register",
  *  description="Receive the confirmation token from user email provider, login the user"
  * )
  */
 public function confirmAction(Request $request, $token)
 {
     return parent::confirmAction($request, $token);
 }