jjzjj

fosuserbundle

全部标签

php - FOS 用户/注册路径在 url 中有效但不作为路径

我正在为用户帐户使用Doctrine和FOS制作一个symfony项目。我有路径http://localhost:8000/register/正常工作并显示我的页面。但是,如果我像这样将它添加为Twig中的路径:NoAccount?Registerhere!我收到这个错误Anexceptionhasbeenthrownduringtherenderingofatemplate("Unableto>generateaURLforthenamedroute"/register"assuchroutedoesnotexist.").我的routing.yml中已经有了所有需要的信息app:r

php - FOS 用户包认证

如何FOSUserBundle通过此服务容器对用户进行身份验证?$this->container->get('security.context')->getToken()->getUser();我想操纵身份验证过程。我应该在bundle的哪个位置查看? 最佳答案 实际上FOSUserBundle不做认证。它实际上提供了一个数据库用户提供程序。身份验证部分由Symfony2的内部form_login身份验证提供程序完成。如果要创建自定义身份验证提供程序,请检查this食谱条目。 关于php

php - 供应商更新破坏了 FOS 用户包 "Call to a member function has() on a non-object"

我为Symfony2.8项目更新了我的供应商,突然登录页面没有加载——相反我得到了这个:Error:Calltoamemberfunctionhas()onanon-objectinvendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Controller/Controller.phpatline184"name":"hazardlog","license":"proprietary","type":"project","autoload":{"psr-4":{"":"src/"},"classmap":["app/AppK

php - 在 Symfony2 和 FOSUserBundle 中,覆盖 login_check

在用户通过身份验证的那一刻,我需要检查他的角色以将他重定向到正确的页面(两个不同的角色对应两个不同的页面)。我没有在文档中找到如何覆盖login_check。从bundle开始,它使用security.yml配置代理告诉引擎转到一个唯一的默认页面。有什么线索吗?同样的注销问题。 最佳答案 如果我没理解错的话,你想将新登录/注销的用户重定向到适当的路由取决于它的作用?Here是关于如何使用表单处理程序对登录/注销进行重定向的教程。 关于php-在Symfony2和FOSUserBundle

php - 更改 FOSUserBundle (Symfony) 中的默认登录页面

我认为这里的问题和答案都应该不会很复杂。我已经安装并配置了FOSUserBundle以在带有Symfony2的项目中使用。我需要知道的是,当用户尝试访问禁止的url时,我在哪里告诉安全性它必须重定向用户的页面。默认为/login。但我想将其更改为更通用的/main。提前致谢 最佳答案 不是FOSUserBundle做的,而是Symfony2中的Security系统做的。您需要在security.yml中设置以下内容:firewalls:main:form_login:default_target_path:/path/to/redi

php - 无法生成表 "user"

当我安装FOSUserBundle(officialdocumentation)时,我尝试使用以下命令生成我的表fos_user:phpapp/consoledoctrine:schema:update--force但控制台返回以下信息Nothingtoupdate-yourdatabaseisalreadyinsyncwiththecurrententitymetadata我使用Symfony2.1和FOSUserBundle的最新版本。app/AppKernel.php包含newFOS\UserBundle\FOSUserBundle(),app/config/config.yml

php - 禁用 SonataUserBundle sonata.user.admin.group 服务

我正在使用SonataAdminBundle和SonataUserBundle。SonataUserBundle注册了一个服务sonata.user.admin.group,SonataAdminBundle会自动检测该服务,以在管理仪表板中设置链接以对CRUD操作进行分组。如何禁用sonata.user.admin.group?我一直在遵循Symfony2文档中的食谱:HowtoOverrideanyPartofaBundle-ServicesandConfigurationCompilingtheContainer-CreatingaCompilerPassWorkingwithC

php - 未登录重定向到 "/login"

如果出现以下情况,我需要将所有人重定向到路由/login:访问/路由(app.php或app_dev.php)尝试访问任何受限区域并且客户端属于组或具有正确的凭据但尚未登录(不确定是否有必要,因为Symfony可能会处理这部分)所以我在我的security.yml中这样做了:security:encoders:FOS\UserBundle\Model\UserInterface:sha512role_hierarchy:ROLE_ADMIN:ROLE_USERROLE_SUPER_ADMIN:ROLE_ADMINproviders:fos_userbundle:id:fos_user.

php - 如何保护 symfony2 中除登录页面之外的整个页面?

我想通过使用FOSUserBundle登录来确保整个站点的安全。我试过这样设置security.ymlsecurity:encoders:Symfony\Component\Security\Core\User\User:plaintextFOS\UserBundle\Model\UserInterface:sha512role_hierarchy:ROLE_ADMIN:ROLE_USERROLE_SUPER_ADMIN:[ROLE_USER,ROLE_ADMIN,ROLE_ALLOWED_TO_SWITCH]providers:fos_userbundle:id:fos_user.u

php - FOSUserBundle - 如何在尝试访问 login_path 时重定向已经登录的用户

是否可以仅针对AUTHENTICATED的用户执行自动重定向到特定路由/login的某些路由(即/)?以及如何?我正在使用FOSUserBundle。这是我的安全配置:security:encoders:FOS\UserBundle\Model\UserInterface:sha512role_hierarchy:ROLE_ADMIN:ROLE_USERROLE_SUPER_ADMIN:ROLE_ADMINproviders:fos_userbundle:id:fos_user.user_provider.username_emailfirewalls:main:pattern:^/f