如何有选择地禁用FosUserBundle中的注册?我想知道如何在FosUserbundle中禁用和启用注册。我正在搜索信息,我发现了这篇文章:https://codereviewvideos.com/course/getting-started-with-fosuserbundle/video/how-to-disable-registation-in-fosuserbundle
我将从那里提取重要信息:
It may be that you wish to enabled and disable registration selectively.
In this instance, and for the improvement of site administrator user experience, we can use a simple parameter value to allow the site registration to be toggled between and enabled and disabled state.
To achieve this, all we need to do is add in a new parameter in to parameters.yml:
# app/config/parameters.yml
parameters:
registration_enabled: true
我尝试了这些信息,但它没有工作,我也不知道我是否忘记了某些事情。我也知道还有其他解决方案,如触摸注册控制器或配置事件监听器,但如果可以使用更清洁的解决方案(如上面更改参数,我更喜欢它)
答案 0 :(得分:1)
您可以通过不包括其路线来禁用注册 如果您通过
导入所有路线python t23.py > x.txt | echo "sadaf" & echo "12"
逐个导入:查看Import FOSUserBundle routing files
不包括
fos_user:
resource: "@FOSUserBundle/Resources/config/routing/all.xml"
答案 1 :(得分:0)
您可以覆盖de FosUserBundleController注册功能,并根据存储的(数据库)变量显示注册表单。