How to definitely disable registration in FOSUserB

2019-04-03 21:37发布

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 action inaccessible and I don't know how? Till now, I just put the ROLE_ADMIN in the access control for the route register to avoid that visitors can go throw it.

Any tips?

7条回答
【Aperson】
2楼-- · 2019-04-03 22:39

You can just change app/config/security.yml:

- { path: ^/register, role: ROLE_ADMIN }

Change from the default (IS_AUTHENTICATED_ANONYMOUSLY) to ROLE_ADMIN and it will stop allowing anonymous users from getting to the /register form.

查看更多
登录 后发表回答