How to definitely disable registration in FOSUserBundle

后端 未结 7 2457
无人及你
无人及你 2021-02-19 03:02

In my project, I allow only one user to manage the content of the website. This user will be added using the command line at first.

Now, I want to get the registration a

7条回答
  •  春和景丽
    2021-02-19 03:14

    You can try to change your routing.yml

    fos_user_registration_register:
        path:  /register{trailingSlash}
        defaults: { _controller: AcmeBundle:Default:register, trailingSlash : "/" }
        requirements: { trailingSlash : "[/]{0,1}" }

    And in your DefaultController

        public function registerAction(Request $request)
        {
           
            return $this->redirectToRoute('404OrWhatYouWant');
        }

提交回复
热议问题