fosuserbundle 找不到“GET /login/”的路由

2024-04-07

我最近使用composer更新了symfony2,现在无法登录。这是相关文件。如果需要更多数据,请告诉我。

应用程序/配置/路由.yml

app_admin:
resource: "@AppAdminBundle/Resources/config/routing.yml"
prefix:   /admin
host: dashboard.muchomonitor.com

app_website:
resource: "@AppWebsiteBundle/Resources/config/routing.yml"
prefix:   /
host: www.muchomonitor.com

app_monitor:
resource: "@AppMonitorBundle/Resources/config/routing.yml"
prefix:   /
host: dashboard.muchomonitor.com

fos_user_security:
resource: "@FOSUserBundle/Resources/config/routing/security.xml"
host: dashboard.muchomonitor.com

fos_user_security_reset:
resource: "@FOSUserBundle/Resources/config/routing/resetting.xml"
prefix: /login
host: dashboard.muchomonitor.com

应用程序/配置/security.yml

security:
encoders:
    FOS\UserBundle\Model\UserInterface: sha512

role_hierarchy:
    ROLE_ADMIN:       ROLE_USER
    ROLE_SUPER_ADMIN: ROLE_ADMIN

providers:
    fos_userbundle:
        id: fos_user.user_provider.username
    user:
        entity: { class: App\MonitorBundle\Entity\User, property: username }

firewalls:
    main:
        pattern: ^/
        provider: user
        form_login:
            provider: fos_userbundle
            csrf_provider: form.csrf_provider
            login_path: fos_user_security_login
            check_path: fos_user_security_check
            default_target_path: /
        logout:       true
        anonymous:    true
        logout:
            path:   /logout
            target: /login

access_control:
    - { path: ^/admin, role: ROLE_SUPER_ADMIN, host: dashboard.muchomonitor.com }
    - { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY, host: dashboard.muchomonitor.com }
    - { path: ^/_, role: ROLE_ADMIN } # Development mode
    - { path: ^/public-status, role: IS_AUTHENTICATED_ANONYMOUSLY, host: dashboard.muchomonitor.com }
    - { path: ^/ipn, role: IS_AUTHENTICATED_ANONYMOUSLY, host: dashboard.muchomonitor.com }
    - { path: ^/invoice, role: IS_AUTHENTICATED_ANONYMOUSLY, host: dashboard.muchomonitor.com }
    - { path: ^/, role: ROLE_USER, host: dashboard.muchomonitor.com }

供应商/friendsofsymfony/user-bundle/FOS/UserBundle/Resources/config/routing/security.xml

<?xml version="1.0" encoding="UTF-8" ?>

<routes xmlns="http://symfony.com/schema/routing"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd">

    <route id="fos_user_security_login" pattern="/login">
        <default key="_controller">FOSUserBundle:Security:login</default>
    </route>

    <route id="fos_user_security_check" pattern="/login_check">
        <default key="_controller">FOSUserBundle:Security:check</default>
        <requirement key="_method">POST</requirement>
    </route>

    <route id="fos_user_security_logout" pattern="/logout">
        <default key="_controller">FOSUserBundle:Security:logout</default>
    </route>

</routes>

供应商/friendsofsymfony/user-bundle/FOS/UserBundle/Resources/config/routing/resetting.xml

<?xml version="1.0" encoding="UTF-8" ?>

<routes xmlns="http://symfony.com/schema/routing"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd">

    <route id="fos_user_resetting_request" pattern="/request">
        <default key="_controller">FOSUserBundle:Resetting:request</default>
        <requirement key="_method">GET</requirement>
    </route>

    <route id="fos_user_resetting_send_email" pattern="/send-email">
        <default key="_controller">FOSUserBundle:Resetting:sendEmail</default>
        <requirement key="_method">POST</requirement>
    </route>

    <route id="fos_user_resetting_check_email" pattern="/check-email">
        <default key="_controller">FOSUserBundle:Resetting:checkEmail</default>
        <requirement key="_method">GET</requirement>
    </route>

    <route id="fos_user_resetting_reset" pattern="/reset/{token}">
        <default key="_controller">FOSUserBundle:Resetting:reset</default>
        <requirement key="_method">GET|POST</requirement>
    </route>

</routes>

php 应用程序/控制台路线:调试

Name                           Method   Scheme Host                       Path
app_admin_users                ANY      ANY    dashboard.muchomonitor.com /admin
app_admin_add_user             ANY      ANY    dashboard.muchomonitor.com /admin
app_admin_edit_user            ANY      ANY    dashboard.muchomonitor.com /admin
app_admin_delete_user          ANY      ANY    dashboard.muchomonitor.com                                    /admin/user/{id}/delete
app_admin_login_user           ANY      ANY    dashboard.muchomonitor.com  /admin/user/{id}/login
app_admin_plans                ANY      ANY    dashboard.muchomonitor.com /admin/plans
app_admin_delete_plan          ANY      ANY    dashboard.muchomonitor.com /admin/plans/{id}/delete
app_admin_edit_plan            ANY      ANY    dashboard.muchomonitor.com /admin/plans/{id}/edit
app_admin_add_plan             ANY      ANY    dashboard.muchomonitor.com /admin/plans/add
app_admin_invoices             ANY      ANY    dashboard.muchomonitor.com /admin/invoices
app_admin_delete_invoice       ANY      ANY    dashboard.muchomonitor.com /admin/invoices/{id}/delete
app_admin_edit_invoice         ANY      ANY    dashboard.muchomonitor.com /admin/invoices/{id}/edit
app_admin_add_invoice          ANY      ANY    dashboard.muchomonitor.com /admin/invoices/add
app_website_index              ANY      ANY    www.muchomonitor.com       /
app_website_pricing            ANY      ANY    www.muchomonitor.com       /pricing
app_website_privacy_policy     ANY      ANY    www.muchomonitor.com       /legal/privacypolicy
app_website_signup             ANY      ANY    www.muchomonitor.com       /signup
app_website_tos                ANY      ANY    www.muchomonitor.com       /legal/termsofservice
app_website_contact_us         ANY      ANY    www.muchomonitor.com       /contactus
app_monitor_dashboard          ANY      ANY    dashboard.muchomonitor.com /
app_monitor_dashboard_search   ANY      ANY    dashboard.muchomonitor.com /dashboard/search/{filter}
app_monitor_dashboard_toggle   ANY      ANY    dashboard.muchomonitor.com /dashboard/toggle/{monitor}
app_monitor_dashboard_delete   ANY      ANY    dashboard.muchomonitor.com /dashboard/delete
app_monitor_dashboard_test     ANY      ANY    dashboard.muchomonitor.com /dashboard/test
app_monitor_monitors           ANY      ANY    dashboard.muchomonitor.com /monitors
app_monitor_monitors_edit      ANY      ANY    dashboard.muchomonitor.com /monitors/edit/{monitor}
app_monitor_monitors_new       ANY      ANY    dashboard.muchomonitor.com /monitors/new
app_monitor_monitors_toggle    ANY      ANY    dashboard.muchomonitor.com /monitors/toggle/{monitor}
app_monitor_monitors_delete    ANY      ANY    dashboard.muchomonitor.com /monitors/delete
app_monitor_monitors_test      ANY      ANY    dashboard.muchomonitor.com /monitors/test
app_monitor_report             ANY      ANY    dashboard.muchomonitor.com /report
app_monitor_reports            ANY      ANY    dashboard.muchomonitor.com /report
app_monitor_report_specific    ANY      ANY    dashboard.muchomonitor.com /report/{monitor}
app_monitor_accounts           ANY      ANY    dashboard.muchomonitor.com /accounts
app_monitor_accounts_edit      ANY      ANY    dashboard.muchomonitor.com /accounts/edit/{id}
app_monitor_accounts_new       ANY      ANY    dashboard.muchomonitor.com /accounts/new
app_monitor_accounts_delete    ANY      ANY    dashboard.muchomonitor.com /accounts/delete
app_monitor_billing            ANY      ANY    dashboard.muchomonitor.com /billing
app_monitor_billing_all        ANY      ANY    dashboard.muchomonitor.com /billing/all
app_monitor_billing_invoice    ANY      ANY    dashboard.muchomonitor.com /invoice/{key}/{id}
app_monitor_notifications      ANY      ANY    dashboard.muchomonitor.com /notifications
app_monitor_ipn                ANY      ANY    dashboard.muchomonitor.com /ipn
app_monitor_ipn_stripe         ANY      ANY    dashboard.muchomonitor.com /ipn-stripe
fos_user_security_login        ANY      ANY    dashboard.muchomonitor.com /login
fos_user_security_check        POST     ANY    dashboard.muchomonitor.com /login_check
fos_user_security_logout       ANY      ANY    dashboard.muchomonitor.com /logout
fos_user_resetting_request     GET      ANY    dashboard.muchomonitor.com /login/request
fos_user_resetting_send_email  POST     ANY    dashboard.muchomonitor.com /login/send-email
fos_user_resetting_check_email GET      ANY    dashboard.muchomonitor.com /login/check-email
fos_user_resetting_reset       GET|POST ANY    dashboard.muchomonitor.com /login/reset/{token}

访问dashboard.muchomonitor.com/login 显示它不起作用,尽管上面的命令是这样说的。

编辑: 我已经解决了这个问题。在路由.yml中

fos_user_security_login:
pattern:  /login/
defaults: { _controller: FOSUserBundle:Security:login }

fos_user_security_check:
pattern:  /login_check
defaults: { _controller: FOSUserBundle:Security:check }

fos_user_security_logout:
pattern:  /logout
defaults: { _controller: FOSUserBundle:Security:logout }

首先...您的登录网址应该(根据您当前的配置)是/login并不是/login/.

The url /login/(带有尾部斜杠)确实如此not存在于您的路由配置中。

正确的方法是让router使用路由名称生成 url,而不是对该 url 进行硬编码/login到您的任何模板中。

{{ path('fos_user_security_login') }}

进一步...请阅读我的回答在这里 https://stackoverflow.com/questions/17406446/how-does-the-login-check-path-route-work-without-default-controller-action/17406584#17406584这解释了方法<firewall>.login.check_path works.

更改主防火墙的提供商user to fos_userbundle.

下没有额外的提供者配置login_path.

firewalls:
    main:
        pattern: ^/
        provider: fos_userbundle
        form_login:
            csrf_provider:       form.csrf_provider
            login_path:          fos_user_security_login
            check_path:          fos_user_security_check
            default_target_path: app_website_index
        logout:
            path:   fos_user_security_logout
            target: fos_user_security_login
        anonymous:    true

此外,您已在防火墙配置中声明注销两次(第二次首先覆盖):

firewalls:
    # ...
    logout:       true
    # ...
    logout:
        path:   /logout
        target: /login
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

fosuserbundle 找不到“GET /login/”的路由 的相关文章

  • Mink 不适用于 behat 3.0.12

    我安装了 Behat Mink 和其他一些相关的软件包 这是我的composer json 文件 require behat behat 3 0 6 behat symfony2 extension dev master behat min
  • 如何在createQueryBuilder中使用通配符?

    在我的存储库类中 我使用 public function getItemsByTag tag qb this gt createQueryBuilder c gt select c gt where c tags LIKE bipolar
  • 如何捕获 Symfony2/Silex 中的错误和异常?

    我想在我的 Silex 应用程序中捕获错误和异常 将它们包装在始终返回给客户端的自定义 JSON 响应中 我发现了三种基本方法 app gt error Symfony Component Debug ErrorHandler regist
  • @UniqueConstraint 和 @Column(unique=true) 选项之间的 Doctrine ORM 级别差异

    在数据库级别 使用一个选项与另一个选项来定义时没有区别独特性如下所示 虽然 UniqueConstraint在其文档中读取 它仅在 SchemaTool 模式生成上下文中有意义 两者之间是否存在 ORM 级别差异 我的意思是 当我们运行查询
  • Symfony:为什么 isInitialized 总是 false?

    我用教义查询了一个用户 customer this gt getDoctrine gt getRepository DemoUserBundle Customer gt find 1 但我得到了结果 顾客 1441 已初始化 错误的 ID
  • Symfony 3新建项目报错

    我开始编写有关 Symfony 3 的教程 在使用以下命令创建新项目时遇到问题 php symfony phar new Symfony 我有这个错误 GuzzleHttp Exception RequestException Error
  • Rails 4 i18n,如何转换子域用于区域设置的路由

    我正在使用子域来确定 Rails 4 网站中的区域设置 我完全按照我想要的方式使用区域设置切换器 但现在我需要翻译路线 并且我不确定继续的最佳方法 我看过https github com kwi i18n routing https git
  • 防止 Twig 函数扩展中的输出转义

    我创建了一个 Twig 扩展 image image png 200 嗨 我知道我可以做 image image png 200 raw 但我更喜欢使用 PHP 代码 这样所有内容 来自这个 图像 扩展 都不会被转义 我看不出这可能 我知道
  • 多态控制器和调用对象

    我的地址具有多态关系 可以由成员或依赖者拥有 一切看起来都很棒 直到我意识到除非我遗漏了一些东西 否则我不知道创建它的对象是什么类型 有没有办法告诉路由文件包含对象的类型 Models class Member lt ActiveRecor
  • 如何从引擎覆盖 Rails 应用程序路由?

    我有一个 Rails 应用程序 我正在尝试将 Rails 引擎集成到其中 主机应用程序有一些捕获所有路由 magic urls match gt admin rendering show match path edit gt admin r
  • 如何使用多个数据库设置 symfony 3 学说迁移?

    我在验证和更新模式时努力让 symfony doctrine 排除数据库视图 我第一次尝试没有教条迁移 看到这个问题 https stackoverflow com questions 46775200 symfony 3 doctrine
  • 将自定义参数传递给 Symfony2 中的自定义 ValidationConstraint

    我正在 Symfony2 中创建一个表单 表格只包含一个book字段允许用户在列表中进行选择Books实体 我需要检查是否选择了Book属于Author我的控制器里有 public class MyFormType extends Abst
  • 使用 rspec 测试嵌套路由

    我正在尝试使用 rspec 测试路由 以下给出了 预期块返回真值 的错误 我不确定我错过了什么 通过浏览器我可以发布到这个网址并且成功 有任何想法吗 谢谢 Routes resources forum topics do resources
  • symfony api 平台深度

    到目前为止 我们一直在 Symfony Doctrine 和 Serializer 深度方面苦苦挣扎 我希望能够使用 Symfony 提供一级深度的 JSON REST API 从而允许我直接从视图管理我的 外键 和关系逻辑 GET peo
  • 创建即用型 symfony 2 应用程序 zip

    我创建了一个 symfomy 应用程序包 可用于从 Android 应用程序收集崩溃报告 对于那些对 Android 和 ACRA 感兴趣的人 https github com marvinlabs acra server https gi
  • Laravel 5.2 带有可变参数的命名路由用法

    我有这样的路线 Open New Subscription page Route get account subscriptions create menu uses gt Subscriptions SubscriptionControl
  • Azure 上的“phpcomposer.phar install”出现“无法终止进程”错误

    我正在尝试将我的 Symfony 2 应用程序部署到 Microsoft Azure 网站云 为此 我按照本指南中的步骤操作http symfony com doc current cookbook deployment azure web
  • Flutter 深度链接

    据Flutter官方介绍深层链接页面 https flutter dev docs development ui navigation deep linking 我们不需要任何插件或本机 Android iOS 代码来处理深层链接 但它并没
  • Symfony Serialize 学说实体

    我有一个简单的实体类
  • Angular 2在实例化子组件之前解析根组件

    当我刷新网络应用程序时 我希望它在实例化任何组件或路由之前请求潜在的登录用户数据 如果找到用户的数据 我想将其注入到我的所有其他子组件所依赖的服务中 场景 假设我有 3 个组件 应用程序 ROOT 主页和关于 如果我将此代码放在 About

随机推荐

  • 如何修复滚动

    我在将工具提示定位在表内的数据列上时遇到一些问题 该表本身位于垂直滚动 div 内 为您提供一点背景 由于我无法控制的遗留问题 我正在开发的页面必须通过固定宽度和高度的 iframe 来显示 我需要显示的数据大约有12列 需要全部显示 一列
  • Django - 为什么syncdb不尊重数据库路由器?

    我已经设置了一个数据库路由器 使用以下命令将不同的应用程序和不同的模型定向到不同的数据库db for read and db for write路由器方法 这非常有效 除了 manage py syncdb不尊重这些路由器设置 When I
  • 作为 JS 的相对初学者 我正在努力尝试找到解决方案 我需要找出无序列表的哪一行被单击 ul li Line 1 li li Line 2 li li Line 3 li ul 我真的不想为每一行添加 onclick 事件 我确信一定有办法
  • 在 Android 中将图像添加到画布

    今天是个好日子 我希望您能帮助我理解如何在视图上实现的 OnTouchEvent 上将图像添加到画布中的概念 到目前为止 这就是我想出的 parent是在此自定义视图中实例化并添加到的活动 Override protected void o
  • mongodb 将 $lte 与 $indexOfArray 一起使用

    与模型的集合 stack mean 3 5 如何查询平均值小于 4 38 的堆栈数组索引 db stacks aggregate project index indexOfArray stack mean lte 4 38 我收到此错误 o
  • “@+id”是什么意思?

    我已经阅读了大部分 Android 文档 但还没有找到任何声明来说明 id 值前缀 id 的含义 我知道 string 及其变体的含义 但不知道 的变体 除了给我答案之外 你能告诉我 Android 文档中记录的位置吗 加号仅表示如果 ID
  • 为什么coq互感类型必须具有相同的参数?

    下列的亚瑟的建议 https stackoverflow com a 17304209 403875 我改变了我的Fixpoint相互关系Inductive这种关系 建立 游戏之间的不同比较 而不是 深入研究 但现在我收到一条全新的错误消息
  • 客户端 XSLT 的当前状态

    我上次听说 暴雪是少数几家将客户端 XSLT 付诸实践的公司之一 2008 年 2011年还是这样 还是现在有更多人在生产中探索这种技术 现代浏览器 IE9 FF4 Chrome 和客户端处理能力似乎已准备好利用此标准 在大规模属性上切实节
  • 为什么有人使用 UTF-8 以外的编码? [关闭]

    Closed 这个问题是基于意见的 help closed questions 目前不接受答案 我想知道为什么开发人员需要使用 UTF 8 以外的编码 维基百科列出了 UTF 8 与各种其他编码相比的优点和缺点 http en wikipe
  • UIACollectionView 单元格与visibleCells

    我正在尝试使用 xcode 4 5 中的自动化编写测试脚本 我有一个UICollectionView我想单击一些当前不可见的单元格 根据文档 http developer apple com library ios documentatio
  • 通过 $.ajax 调用返回附件

    我的页面上有一个 iframe 在该 iframe 内我执行代码 ajax url SamplePage ExportToExcel async false data par type POST 响应返回正常 但是我没有收到 保存附件 对话
  • Powershell 替代 Unix who 命令显示 ssh 会话

    我在 Windows 服务器上 想知道谁通过 ssh 进入了服务器 在 Linux 上 以下命令有效 who s Windows 10 上的替代方案是什么 使用提升的 PowerShell 您可以通过以下方式列出所有登录用户 Get Cim
  • Grizzly,共享 spring 生成的上下文

    我有一个独立的 spring 项目 我需要用它启动一个嵌入式休息服务 我可以用 grizzly 启动服务器 我的问题是 当我启动 grizzly 服务器时 它会创建自己的应用程序上下文 因此我的父应用程序创建的实例无法通过 REST 服务访
  • type=”number” 的 html 标签输入和基于文化的小数点分隔符

    当我打开具有另一种文化和用户界面 即瑞典 的网站时 我需要的是在英语浏览器中查看正确的小数分隔符 怎么存档呢
  • 在 Kotlin 中实现 Java 接口

    我有一个Java界面 public interface NonHindiQuery void onNonHindiQueryReceived String Query 我想实施它Kotlin class class MainActivity
  • _ptr 或 _var - 哪一个用作类字段,为什么?

    我有一堂课 class Impl1 public POA I1 private Impl2 var ob public Impl2 ptr get return ob void set Impl2 ptr ob this gt ob ob
  • 如何将按钮添加到 InAppSettingsKit 设置视图 (iPhone/iPad)?

    我一直在查看 InAppSettingsKit 提供的示例应用程序 我注意到使用了几个按钮 我想在我的应用程序中集成一个名为 重置 的红色按钮 但我不知道该怎么做 我查看了示例应用程序中的代码 但我对这一切有点迷失 请问有人可以帮我吗 在花
  • 调用expire_fragment会引发“要使用#url_for,您必须显式包含路由助手”错误

    我已经将 Rails 2 应用程序升级到 Rails 3 2 13 并且在尝试启用缓存时遇到问题 缓存在 Rails 2 中有效 我使用的是相同版本的 Ruby 1 8 7 我不确定它是否相关 但我正在 OSX 上开发 调用 expire
  • 在 VS2012 中使用 NUnit 进行调试而不抛出异常?

    我使用 NUnit 测试适配器将 NUnit 运行到 VS2012 中 并且可以很好地运行所有测试 但如果我想在每次点击断言时调试所有测试 则会引发异常 如何让它不抛出断言异常 我做错了什么可怕的事情吗 连接调试器后 失败的断言会引发异常
  • fosuserbundle 找不到“GET /login/”的路由

    我最近使用composer更新了symfony2 现在无法登录 这是相关文件 如果需要更多数据 请告诉我 应用程序 配置 路由 yml app admin resource AppAdminBundle Resources config r