public function confirmEmailAction(Application $app, Request $request, $token)
    {
        $user = $this->userManager->findOneBy(array('confirmationToken' => $token));
        if (!$user) {
            $app['session']->getFlashBag()->set('alert', 'Sorry, your email confirmation link has expired.');

            return $app->redirect($app['url_generator']->generate('user.login'));
        }

        $user->setConfirmationToken(null);
        $user->setEnabled(true);
        $this->userManager->update($user);

        $this->userManager->loginAsUser($user);

        $app['session']->getFlashBag()->set('alert', 'Thank you! Your account has been activated.');

        return $app->redirect($app['url_generator']->generate('user.view', array('id' => $user->getId())));
    }
public function confirmEmailAction(Application $app, Request $request, $token)
    {
        $user = $this->userManager->findOneBy(array('confirmationToken' => $token));
        if (!$user) {
            $app['session']->getFlashBag()->set('alert', 'Sorry, your email confirmation link has expired.');

            return $app->redirect($app['url_generator']->generate('user.login'));
        }

        $user->setConfirmationToken(null);
        $user->setEnabled(true);
        $this->userManager->update($user);

        $this->userManager->loginAsUser($user);

        $app['session']->getFlashBag()->set('alert', 'Thank you! Your account has been activated.');

        return $app->redirect($app['url_generator']->generate('user.view', array('id' => $user->getId())));
    }
public function confirmEmailAction ( Application $ app , Request $ request , $ token ) { $ user = $ this -> userManager -> findOneBy ( array ( 'confirmationToken' => $ token ) ) ; if ( ! $ user ) { $ app [ 'session' ] -> getFlashBag ( ) -> set ( 'alert' , 'Sorry, your email confirmation link has expired.' ) ; return $ app -> redirect ( $ app [ 'url_generator' ] -> generate ( 'user.login' ) ) ; } $ user -> setConfirmationToken ( null ) ; $ user -> setEnabled ( true ) ; $ this -> userManager -> update ( $ user ) ; $ this -> userManager -> loginAsUser ( $ user ) ; $ app [ 'session' ] -> getFlashBag ( ) -> set ( 'alert' , 'Thank you! Your account has been activated.' ) ; return $ app -> redirect ( $ app [ 'url_generator' ] -> generate ( 'user.view' , array ( 'id' => $ user -> getId ( ) ) ) ) ; }
Action to handle email confirmation links.

@param Application $app
@param Request $request
@param string $token
@return \Symfony\Component\HttpFoundation\RedirectResponse
@throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
Action to handle email confirmation links .