public function changePasswordAction()
    {
        $user = $this->getUser();
        if (!is_object($user) || !$user instanceof UserInterface) {
            throw new AccessDeniedException('This user does not have access to this section.');
        }
        
        $formProfile = $this->createForm(
            new ProfileFormType($this->container->getParameter('fos_user.model.user.class')),
            $user
        );
        $formPassword = $this->container->get('fos_user.change_password.form');
        
        $formHandler = $this->container->get('fos_user.change_password.form.handler');
        $process = $formHandler->process($user);
        if ($process) {
            $this->container->get('session')->getFlashBag()->set('success', $this->get('translator')->trans('change_password.flash.success', array(), 'FOSUserBundle'));
            return $this->redirect($this->generateUrl('olix_security_profile_edit'));
        }
        
        return $this->container->get('olix.admin')->render('OlixSecurityBundle:Profile:edit.html.twig', null, array(
            'user' => $user,
            'tab'  => 'password',
            'form' => array(
                'profile'  => $formProfile->createView(),
                'password' => $formPassword->createView(),
            ),
        ));
    }
public function changePasswordAction()
    {
        $user = $this->getUser();
        if (!is_object($user) || !$user instanceof UserInterface) {
            throw new AccessDeniedException('This user does not have access to this section.');
        }
        
        $formProfile = $this->createForm(
            new ProfileFormType($this->container->getParameter('fos_user.model.user.class')),
            $user
        );
        $formPassword = $this->container->get('fos_user.change_password.form');
        
        $formHandler = $this->container->get('fos_user.change_password.form.handler');
        $process = $formHandler->process($user);
        if ($process) {
            $this->container->get('session')->getFlashBag()->set('success', $this->get('translator')->trans('change_password.flash.success', array(), 'FOSUserBundle'));
            return $this->redirect($this->generateUrl('olix_security_profile_edit'));
        }
        
        return $this->container->get('olix.admin')->render('OlixSecurityBundle:Profile:edit.html.twig', null, array(
            'user' => $user,
            'tab'  => 'password',
            'form' => array(
                'profile'  => $formProfile->createView(),
                'password' => $formPassword->createView(),
            ),
        ));
    }
public function changePasswordAction ( ) { $ user = $ this -> getUser ( ) ; if ( ! is_object ( $ user ) || ! $ user instanceof UserInterface ) { throw new AccessDeniedException ( 'This user does not have access to this section.' ) ; } $ formProfile = $ this -> createForm ( new ProfileFormType ( $ this -> container -> getParameter ( 'fos_user.model.user.class' ) ) , $ user ) ; $ formPassword = $ this -> container -> get ( 'fos_user.change_password.form' ) ; $ formHandler = $ this -> container -> get ( 'fos_user.change_password.form.handler' ) ; $ process = $ formHandler -> process ( $ user ) ; if ( $ process ) { $ this -> container -> get ( 'session' ) -> getFlashBag ( ) -> set ( 'success' , $ this -> get ( 'translator' ) -> trans ( 'change_password.flash.success' , array ( ) , 'FOSUserBundle' ) ) ; return $ this -> redirect ( $ this -> generateUrl ( 'olix_security_profile_edit' ) ) ; } return $ this -> container -> get ( 'olix.admin' ) -> render ( 'OlixSecurityBundle:Profile:edit.html.twig' , null , array ( 'user' => $ user , 'tab' => 'password' , 'form' => array ( 'profile' => $ formProfile -> createView ( ) , 'password' => $ formPassword -> createView ( ) , ) , ) ) ; }
Changement du mot de passe

@return \Symfony\Component\HttpFoundation\Response
Changement du mot de passe