public function profileAction(Request $request)
    {
        $user = $this->getUser();

        $form = $this->createForm(ProfileType::class, $user);
        $form->handleRequest($request);

        if ($form->isValid()) {

            if ($user->isTwoFactorEnabled() == false) {
                $user->setGoogleAuthenticatorSecret(null);
            }

            $this->get('fos_user.user_manager')->updateUser($user, true);

            if ($user->isTwoFactorEnabled() == true && empty($user->getGoogleAuthenticatorSecret())) {
                return $this->redirectToRoute('opifer_cms_user_activate_2fa');                    
            }

            $this->addFlash('success', 'Your profile was updated successfully!');

            return $this->redirectToRoute('opifer_cms_user_profile');
        }

        return $this->render('OpiferCmsBundle:Backend/User:profile.html.twig', [
            'form' => $form->createView(),
            'user' => $user,
        ]);
    }
public function profileAction(Request $request)
    {
        $user = $this->getUser();

        $form = $this->createForm(ProfileType::class, $user);
        $form->handleRequest($request);

        if ($form->isValid()) {

            if ($user->isTwoFactorEnabled() == false) {
                $user->setGoogleAuthenticatorSecret(null);
            }

            $this->get('fos_user.user_manager')->updateUser($user, true);

            if ($user->isTwoFactorEnabled() == true && empty($user->getGoogleAuthenticatorSecret())) {
                return $this->redirectToRoute('opifer_cms_user_activate_2fa');                    
            }

            $this->addFlash('success', 'Your profile was updated successfully!');

            return $this->redirectToRoute('opifer_cms_user_profile');
        }

        return $this->render('OpiferCmsBundle:Backend/User:profile.html.twig', [
            'form' => $form->createView(),
            'user' => $user,
        ]);
    }
public function profileAction ( Request $ request ) { $ user = $ this -> getUser ( ) ; $ form = $ this -> createForm ( ProfileType :: class , $ user ) ; $ form -> handleRequest ( $ request ) ; if ( $ form -> isValid ( ) ) { if ( $ user -> isTwoFactorEnabled ( ) == false ) { $ user -> setGoogleAuthenticatorSecret ( null ) ; } $ this -> get ( 'fos_user.user_manager' ) -> updateUser ( $ user , true ) ; if ( $ user -> isTwoFactorEnabled ( ) == true && empty ( $ user -> getGoogleAuthenticatorSecret ( ) ) ) { return $ this -> redirectToRoute ( 'opifer_cms_user_activate_2fa' ) ; } $ this -> addFlash ( 'success' , 'Your profile was updated successfully!' ) ; return $ this -> redirectToRoute ( 'opifer_cms_user_profile' ) ; } return $ this -> render ( 'OpiferCmsBundle:Backend/User:profile.html.twig' , [ 'form' => $ form -> createView ( ) , 'user' => $ user , ] ) ; }
Edit the current users' profile.

@param Request $request

@return Response
Edit the current users profile .