public function confirmAction($token)
    {
        $user = $this->container->get('fos_user.user_manager')->findUserByConfirmationToken($token);

        if (null === $user) {
            throw new NotFoundHttpException(
                sprintf('The user with confirmation token "%s" does not exist', $token)
            );
        }

        $form = $this->container->get('canaltp_user.confirmation.form');
        $formHandler = $this->container->get('canaltp_user.confirmation.form.handler.default');
        $process = $formHandler->process($user);

        if ($process) {
            $user->setEnabled(true);
            $user->setConfirmationToken(null);
            $user->setLastLogin(new \DateTime());

            $response = new RedirectResponse(
                $this->container->get('router')->generate('fos_user_registration_confirmed')
            );
            $this->container->get('fos_user.user_manager')->updateUser($user);
            $this->authenticateUser($user, $response);

            return $response;
        }

        return $this->container->get('templating')->renderResponse(
            'CanalTPSamEcoreUserManagerBundle:Registration:confirm.html.'.$this->getEngine(),
            array(
                'token' => $token,
                'form' => $form->createView(),
            )
        );

    }
public function confirmAction($token)
    {
        $user = $this->container->get('fos_user.user_manager')->findUserByConfirmationToken($token);

        if (null === $user) {
            throw new NotFoundHttpException(
                sprintf('The user with confirmation token "%s" does not exist', $token)
            );
        }

        $form = $this->container->get('canaltp_user.confirmation.form');
        $formHandler = $this->container->get('canaltp_user.confirmation.form.handler.default');
        $process = $formHandler->process($user);

        if ($process) {
            $user->setEnabled(true);
            $user->setConfirmationToken(null);
            $user->setLastLogin(new \DateTime());

            $response = new RedirectResponse(
                $this->container->get('router')->generate('fos_user_registration_confirmed')
            );
            $this->container->get('fos_user.user_manager')->updateUser($user);
            $this->authenticateUser($user, $response);

            return $response;
        }

        return $this->container->get('templating')->renderResponse(
            'CanalTPSamEcoreUserManagerBundle:Registration:confirm.html.'.$this->getEngine(),
            array(
                'token' => $token,
                'form' => $form->createView(),
            )
        );

    }
public function confirmAction ( $ token ) { $ user = $ this -> container -> get ( 'fos_user.user_manager' ) -> findUserByConfirmationToken ( $ token ) ; if ( null === $ user ) { throw new NotFoundHttpException ( sprintf ( 'The user with confirmation token "%s" does not exist' , $ token ) ) ; } $ form = $ this -> container -> get ( 'canaltp_user.confirmation.form' ) ; $ formHandler = $ this -> container -> get ( 'canaltp_user.confirmation.form.handler.default' ) ; $ process = $ formHandler -> process ( $ user ) ; if ( $ process ) { $ user -> setEnabled ( true ) ; $ user -> setConfirmationToken ( null ) ; $ user -> setLastLogin ( new \ DateTime ( ) ) ; $ response = new RedirectResponse ( $ this -> container -> get ( 'router' ) -> generate ( 'fos_user_registration_confirmed' ) ) ; $ this -> container -> get ( 'fos_user.user_manager' ) -> updateUser ( $ user ) ; $ this -> authenticateUser ( $ user , $ response ) ; return $ response ; } return $ this -> container -> get ( 'templating' ) -> renderResponse ( 'CanalTPSamEcoreUserManagerBundle:Registration:confirm.html.' . $ this -> getEngine ( ) , array ( 'token' => $ token , 'form' => $ form -> createView ( ) , ) ) ; }
Receive the confirmation token from user email provider, login the user
Receive the confirmation token from user email provider login the user