Controller/Admin/ResettingController.php
public function resetAction($token)
    {
        if ($this->container->get('security.context')->isGranted('IS_AUTHENTICATED_FULLY')) {
            return new RedirectResponse($this->container->get('router')->generate('sonata_admin_dashboard'));
        }
        $user = $this->container->get('fos_user.user_manager')->findUserByConfirmationToken($token);
        if (null === $user) {
            throw new NotFoundHttpException(sprintf('The user with "confirmation token" does not exist for value "%s"', $token));
        }
        if (!$user->isPasswordRequestNonExpired($this->container->getParameter('fos_user.resetting.token_ttl'))) {
            return new RedirectResponse($this->container->get('router')->generate('sonata_user_admin_resetting_request'));
        }
        $form = $this->container->get('fos_user.resetting.form');
        $formHandler = $this->container->get('fos_user.resetting.form.handler');
        $process = $formHandler->process($user);
        if ($process) {
            $this->setFlash('fos_user_success', 'resetting.flash.success');
            $response = new RedirectResponse($this->container->get('router')->generate('sonata_admin_dashboard'));
            $this->authenticateUser($user, $response);
            return $response;
        }
        return $this->container->get('templating')->renderResponse('SonataUserBundle:Admin:Security/Resetting/reset.html.' . $this->getEngine(), array(
            'token' => $token,
            'form' => $form->createView(),
            'base_template' => $this->container->get('sonata.admin.pool')->getTemplate('layout'),
            'admin_pool' => $this->container->get('sonata.admin.pool'),
        ));
    }
public function resetAction($token)
    {
        if ($this->container->get('security.context')->isGranted('IS_AUTHENTICATED_FULLY')) {
            return new RedirectResponse($this->container->get('router')->generate('sonata_admin_dashboard'));
        }
        $user = $this->container->get('fos_user.user_manager')->findUserByConfirmationToken($token);
        if (null === $user) {
            throw new NotFoundHttpException(sprintf('The user with "confirmation token" does not exist for value "%s"', $token));
        }
        if (!$user->isPasswordRequestNonExpired($this->container->getParameter('fos_user.resetting.token_ttl'))) {
            return new RedirectResponse($this->container->get('router')->generate('sonata_user_admin_resetting_request'));
        }
        $form = $this->container->get('fos_user.resetting.form');
        $formHandler = $this->container->get('fos_user.resetting.form.handler');
        $process = $formHandler->process($user);
        if ($process) {
            $this->setFlash('fos_user_success', 'resetting.flash.success');
            $response = new RedirectResponse($this->container->get('router')->generate('sonata_admin_dashboard'));
            $this->authenticateUser($user, $response);
            return $response;
        }
        return $this->container->get('templating')->renderResponse('SonataUserBundle:Admin:Security/Resetting/reset.html.' . $this->getEngine(), array(
            'token' => $token,
            'form' => $form->createView(),
            'base_template' => $this->container->get('sonata.admin.pool')->getTemplate('layout'),
            'admin_pool' => $this->container->get('sonata.admin.pool'),
        ));
    }
public function resetAction ( $ token ) { if ( $ this -> container -> get ( 'security.context' ) -> isGranted ( 'IS_AUTHENTICATED_FULLY' ) ) { return new RedirectResponse ( $ this -> container -> get ( 'router' ) -> generate ( 'sonata_admin_dashboard' ) ) ; } $ user = $ this -> container -> get ( 'fos_user.user_manager' ) -> findUserByConfirmationToken ( $ token ) ; if ( null === $ user ) { throw new NotFoundHttpException ( sprintf ( 'The user with "confirmation token" does not exist for value "%s"' , $ token ) ) ; } if ( ! $ user -> isPasswordRequestNonExpired ( $ this -> container -> getParameter ( 'fos_user.resetting.token_ttl' ) ) ) { return new RedirectResponse ( $ this -> container -> get ( 'router' ) -> generate ( 'sonata_user_admin_resetting_request' ) ) ; } $ form = $ this -> container -> get ( 'fos_user.resetting.form' ) ; $ formHandler = $ this -> container -> get ( 'fos_user.resetting.form.handler' ) ; $ process = $ formHandler -> process ( $ user ) ; if ( $ process ) { $ this -> setFlash ( 'fos_user_success' , 'resetting.flash.success' ) ; $ response = new RedirectResponse ( $ this -> container -> get ( 'router' ) -> generate ( 'sonata_admin_dashboard' ) ) ; $ this -> authenticateUser ( $ user , $ response ) ; return $ response ; } return $ this -> container -> get ( 'templating' ) -> renderResponse ( 'SonataUserBundle:Admin:Security/Resetting/reset.html.' . $ this -> getEngine ( ) , array ( 'token' => $ token , 'form' => $ form -> createView ( ) , 'base_template' => $ this -> container -> get ( 'sonata.admin.pool' ) -> getTemplate ( 'layout' ) , 'admin_pool' => $ this -> container -> get ( 'sonata.admin.pool' ) , ) ) ; }
{@inheritdoc}
{