public function resetConfirmationAction($uuid) {
        $em = $this->container->get("doctrine")->getEntityManager();
        $request = $this->container->get("request");
        $confirm_data = $request->get("haven_bundle_securitybundle_confirmtype");
        $user_reset = $em->getRepository("HavenSecurityBundle:UserReset")->findOneBy(array("uuid" => $uuid));
        if (null == $user_reset) {
            throw new \Symfony\Component\HttpKernel\Exception\NotFoundHttpException("page.pas.trouve");
        }

        $confirm_form = $this->container->get("form.factory")->create(new \Haven\SecurityBundle\Form\ConfirmType());

        $templating = $this->container->get("templating");
        $render = null;
        if ($request->getMethod() == "POST") {
            $confirm_form->bind($confirm_data);
            if ($confirm_form->isValid()) {
                if ($user_reset->getConfirmation() == $confirm_data["confirmation"] && !null == $user_reset->getUser()) {
                    $factory = $this->container->get('security.encoder_factory');
                    $user = $user_reset->getUser();
                    $encoder = $factory->getEncoder($user);
                    $user->setPassword($encoder->encodePassword($confirm_data["plainPassword"]["first"], $user->getSalt()));
                } else {
                    $this->get('session')->getFlashBag()->add("error", "confirmation.invalid");
                    return array("confirm_form" => $confirm_form->createView(), "uuid" => $uuid);
//                    throw new \Exception("L'utilisateur n'existe pas ou n'a pas fait de demande de réinitialisation");
                }
                $em->persist($user);
                $em->remove($user_reset);
                $em->flush();
//                $this->get('session')->getFlashBag()->add("success", "activation.reussi");
                return new \Symfony\Component\HttpFoundation\RedirectResponse($this->container->get("router")->generate("haven_security_login_login", array("_locale", $request->get("_locale"))));
            }
        }
        return array("confirm_form" => $confirm_form->createView(), "uuid" => $uuid);
    }
public function resetConfirmationAction($uuid) {
        $em = $this->container->get("doctrine")->getEntityManager();
        $request = $this->container->get("request");
        $confirm_data = $request->get("haven_bundle_securitybundle_confirmtype");
        $user_reset = $em->getRepository("HavenSecurityBundle:UserReset")->findOneBy(array("uuid" => $uuid));
        if (null == $user_reset) {
            throw new \Symfony\Component\HttpKernel\Exception\NotFoundHttpException("page.pas.trouve");
        }

        $confirm_form = $this->container->get("form.factory")->create(new \Haven\SecurityBundle\Form\ConfirmType());

        $templating = $this->container->get("templating");
        $render = null;
        if ($request->getMethod() == "POST") {
            $confirm_form->bind($confirm_data);
            if ($confirm_form->isValid()) {
                if ($user_reset->getConfirmation() == $confirm_data["confirmation"] && !null == $user_reset->getUser()) {
                    $factory = $this->container->get('security.encoder_factory');
                    $user = $user_reset->getUser();
                    $encoder = $factory->getEncoder($user);
                    $user->setPassword($encoder->encodePassword($confirm_data["plainPassword"]["first"], $user->getSalt()));
                } else {
                    $this->get('session')->getFlashBag()->add("error", "confirmation.invalid");
                    return array("confirm_form" => $confirm_form->createView(), "uuid" => $uuid);
//                    throw new \Exception("L'utilisateur n'existe pas ou n'a pas fait de demande de réinitialisation");
                }
                $em->persist($user);
                $em->remove($user_reset);
                $em->flush();
//                $this->get('session')->getFlashBag()->add("success", "activation.reussi");
                return new \Symfony\Component\HttpFoundation\RedirectResponse($this->container->get("router")->generate("haven_security_login_login", array("_locale", $request->get("_locale"))));
            }
        }
        return array("confirm_form" => $confirm_form->createView(), "uuid" => $uuid);
    }
public function resetConfirmationAction ( $ uuid ) { $ em = $ this -> container -> get ( "doctrine" ) -> getEntityManager ( ) ; $ request = $ this -> container -> get ( "request" ) ; $ confirm_data = $ request -> get ( "haven_bundle_securitybundle_confirmtype" ) ; $ user_reset = $ em -> getRepository ( "HavenSecurityBundle:UserReset" ) -> findOneBy ( array ( "uuid" => $ uuid ) ) ; if ( null == $ user_reset ) { throw new \ Symfony \ Component \ HttpKernel \ Exception \ NotFoundHttpException ( "page.pas.trouve" ) ; } $ confirm_form = $ this -> container -> get ( "form.factory" ) -> create ( new \ Haven \ SecurityBundle \ Form \ ConfirmType ( ) ) ; $ templating = $ this -> container -> get ( "templating" ) ; $ render = null ; if ( $ request -> getMethod ( ) == "POST" ) { $ confirm_form -> bind ( $ confirm_data ) ; if ( $ confirm_form -> isValid ( ) ) { if ( $ user_reset -> getConfirmation ( ) == $ confirm_data [ "confirmation" ] && ! null == $ user_reset -> getUser ( ) ) { $ factory = $ this -> container -> get ( 'security.encoder_factory' ) ; $ user = $ user_reset -> getUser ( ) ; $ encoder = $ factory -> getEncoder ( $ user ) ; $ user -> setPassword ( $ encoder -> encodePassword ( $ confirm_data [ "plainPassword" ] [ "first" ] , $ user -> getSalt ( ) ) ) ; } else { $ this -> get ( 'session' ) -> getFlashBag ( ) -> add ( "error" , "confirmation.invalid" ) ; return array ( "confirm_form" => $ confirm_form -> createView ( ) , "uuid" => $ uuid ) ; //                    throw new \Exception("L'utilisateur n'existe pas ou n'a pas fait de demande de réinitialisation"); } $ em -> persist ( $ user ) ; $ em -> remove ( $ user_reset ) ; $ em -> flush ( ) ; //                $this->get('session')->getFlashBag()->add("success", "activation.reussi"); return new \ Symfony \ Component \ HttpFoundation \ RedirectResponse ( $ this -> container -> get ( "router" ) -> generate ( "haven_security_login_login" , array ( "_locale" , $ request -> get ( "_locale" ) ) ) ) ; } } return array ( "confirm_form" => $ confirm_form -> createView ( ) , "uuid" => $ uuid ) ; }
reset confirmation by the user
@Route("/{_locale}/auth/confirmation/{uuid}")
@Template()
reset confirmation by the user