首页 \ 问答 \ Symfony2嵌入了所有FOSUserBundle表单(Symfony2 embed all FOSUserBundle forms)

Symfony2嵌入了所有FOSUserBundle表单(Symfony2 embed all FOSUserBundle forms)

我正在尝试将所有FOSUserBundle表单嵌入到布局左侧的侧边栏中。

这是我的src/My/MainBundle/Resources/config/routing.yml

index:
    pattern: /
    defaults: { _controller: MyMainBundle:Main:index }

login:
    pattern: /login
    defaults: { _controller: MyMainBundle:Main:index }

resetting_request:
    pattern: /resetting/request
    defaults: { _controller: MyMainBundle:Main:index }

resetting_send_email:
    pattern: /resetting/send-email
    defaults: { _controller: MyMainBundle:Main:index }

src/My/MainBundle/Resources/views/layout.html.twig ,我有(除其他外):

<div id="sidebar">
    {% if is_granted('IS_AUTHENTICATED_REMEMBERED') %}
        <p>You are logged in blah blah blah</p>
    {% elseif app.request.attributes.get('_route') == 'resetting_request' %}
        {{ render(controller('FOSUserBundle:Resetting:request')) }}
    {% elseif app.request.attributes.get('_route') == 'resetting_send_email' %}
        {{ render(controller('FOSUserBundle:Resetting:sendEmail')) }}
    {% else %}
        {{ render(controller('FOSUserBundle:Security:login')) }}
    {% endif %}
</div>

登录表单工作正常,它提交到/ login_check,然后重定向到请求的页面,如果登录名和密码是正确的,或者,如果登录名或密码错误,它会重定向到/ login(在这种情况下,它正确在侧栏中显示表单,并显示相应的错误消息)。

我在“忘记密码?”时遇到问题。 但形式。

它显示在侧边栏中,并提交/重置/发送电子邮件,但它不会重定向到任何内容。 然后它告诉我用户名或电子邮件“”不存在。

如果我评论“resetting_send_email”路由,那么“发送电子邮件”操作有效,但输出不在侧边栏中(事实上,它周围甚至没有布局)。

有任何想法吗?


I'm trying to embed all FOSUserBundle forms in a sidebar on the left of my layout.

Here's my src/My/MainBundle/Resources/config/routing.yml:

index:
    pattern: /
    defaults: { _controller: MyMainBundle:Main:index }

login:
    pattern: /login
    defaults: { _controller: MyMainBundle:Main:index }

resetting_request:
    pattern: /resetting/request
    defaults: { _controller: MyMainBundle:Main:index }

resetting_send_email:
    pattern: /resetting/send-email
    defaults: { _controller: MyMainBundle:Main:index }

In src/My/MainBundle/Resources/views/layout.html.twig, I have (among other things):

<div id="sidebar">
    {% if is_granted('IS_AUTHENTICATED_REMEMBERED') %}
        <p>You are logged in blah blah blah</p>
    {% elseif app.request.attributes.get('_route') == 'resetting_request' %}
        {{ render(controller('FOSUserBundle:Resetting:request')) }}
    {% elseif app.request.attributes.get('_route') == 'resetting_send_email' %}
        {{ render(controller('FOSUserBundle:Resetting:sendEmail')) }}
    {% else %}
        {{ render(controller('FOSUserBundle:Security:login')) }}
    {% endif %}
</div>

The login form works fine, it submits to /login_check, which then redirects to the page that was requested, if the login and password are correct, or, it redirects to /login if the login or password are wrong (in that case it correctly displays the form in the sidebar, with the corresponding error message).

I'm having trouble with the "Forgot password?" form, though.

It shows up in the sidebar, and submits to /resetting/send-email, but then it doesn't redirect to anything. It then tells me that the username or email "" doesn't exist.

If I comment the "resetting_send_email" route, then the "send email" action works, but the output is not in the sidebar (in fact, there isn't even a layout around it).

Any ideas?


原文:https://stackoverflow.com/questions/22507817
更新时间:2023-10-07 17:10

最满意答案

问题是XML。 结构不合理。 我现在改变了结构和工作。

谢谢。


The problem was the XML. It wasn't structured properly. I changed the structure and its working now.

Thank You.

相关问答

更多
  • 由于您在e.cancel = true设置了e.cancel = true ,因此NavigationMode将不会Back OnNavigatedFrom 。 尝试在页面中使用全局变量,默认情况下为false ,并在OnBackKeyPress中将其设置为true 。 然后,在OnNavigatedFrom检查此变量而不是NavigationMode.Back 。 Since you're setting e.cancel = true in OnBackKeyPress, the NavigationM ...
  • 实际上我们调用java代码来压缩文件。 如: &buffer = CreateJavaArray("byte[]", 18024); &zipStream = CreateJavaObject("java.util.zip.ZipOutputStream", CreateJavaObject("java.io.FileOutputStream", &outDir | &outZip)); For &i = 1 To &inFiles.Len &zipStream.putN ...
  • $.fn.get与$.fn.map一起使用时,返回一个没有addClass和更多jQuery方法的HTMLElement 。 所以你必须使用eq进行以下操作(或者:first根据你的需要) $('.a').eq(0).addClass('g'); // assuming you want first .a 如果你想要一种本地的方式(出于一些奇怪的原因)那么你就可以做到 $('.a').get(0).className += " g"; // space is important -------^ $.f ...
  • WinJS.Navigation命名空间提供状态和历史管理,但它实际上并不执行导航。 要从一个页面移动到另一个页面,您需要为WinJS.Navigation命名空间中的一个事件定义处理函数 - 这使您可以以对您的应用程序有意义的方式响应对WinJS.Navigation.navigate方法的调用。 作为演示,这里是一个homePage.html文件,其中包含一个NavBar,其中包含一个命令,该命令将成为导航的触发器。
  • new obj(); 返回一个对象而不是一个函数,所以当你调用时 var animal = new obj(); animal变量将填充一个非功能的对象。 这个说法 var dog = new animal(); 返回undefined因为animal不是函数(构造函数)。 请注意,operator new仅用于函数,不适用于文字对象 有关此主题的更多信息,请查看此问题 一个简单的JavaScript继承模式 首先定义一个基类(JS中没有类概念,但为了更方便我使用它) function Obj(name ...
  • 更改return array($power, $exp-1); return array( pow($base, $exp-1), $exp-1); 您将根据$exp返回$power的$exp ,而不是$exp-1 。 Change return array($power, $exp-1); to return array( pow($base, $exp-1), $exp-1); You are returning the value for $power based on $exp, not $exp- ...
  • intdiv()是上一份工作的错误工具。 除法的结果将是一个intdiv将转换为0的浮点数。 代码:( 演示 ) function getyearly($monthly, $yearly) { if(!empty($monthly) && !empty($yearly)) { $permonth=intdiv((int)$yearly, 12); echo "Single payment will feel like 12-monthly payments of: $ ...
  • 问题是XML。 结构不合理。 我现在改变了结构和工作。 谢谢。 The problem was the XML. It wasn't structured properly. I changed the structure and its working now. Thank You.
  • 在与建筑师讨论并获得他们的反馈之后。 以异步方式发送消息绝对没问题。 我们可以让应用程序引擎成功,然后我们可以填充物理表,因为我们不断消耗消息并相应地更新每行的状态,而不是让应用程序引擎在一切都完成之前进入休眠状态。 感谢这个精彩的社区,我希望这个主题可以帮助任何可以从这种方法中受益的人。 After discussing it with the architects and getting their feedback. It is absolutely fine to send the messages ...
  • [T <: Number]类型边界意味着T必须是Number的子类型 。 从Int到Integer的隐式转换并没有给你这个,因为即使转换可用,它仍然不意味着Int是Number的子类型。 幸运的是,有一个类似的称为视图边界的东西,写成[T <% Number] ,它准确指定了你想要的东西,有一个从T到Number的隐式转换 The [T <: Number] type bounds means that T must be a subtype of Number. The implicit conversi ...

相关文章

更多

最新问答

更多
  • 如何在Laravel 5.2中使用paginate与关系?(How to use paginate with relationships in Laravel 5.2?)
  • linux的常用命令干什么用的
  • 由于有四个新控制器,Auth刀片是否有任何变化?(Are there any changes in Auth blades due to four new controllers?)
  • 如何交换返回集中的行?(How to swap rows in a return set?)
  • 在ios 7中的UITableView部分周围绘制边界线(draw borderline around UITableView section in ios 7)
  • 使用Boost.Spirit Qi和Lex时的空白队长(Whitespace skipper when using Boost.Spirit Qi and Lex)
  • Java中的不可变类(Immutable class in Java)
  • WordPress发布查询(WordPress post query)
  • 如何在关系数据库中存储与IPv6兼容的地址(How to store IPv6-compatible address in a relational database)
  • 是否可以检查对象值的条件并返回密钥?(Is it possible to check the condition of a value of an object and JUST return the key?)
  • GEP分段错误LLVM C ++ API(GEP segmentation fault LLVM C++ API)
  • 绑定属性设置器未被调用(Bound Property Setter not getting Called)
  • linux ubuntu14.04版没有那个文件或目录
  • 如何使用JSF EL表达式在param中迭代变量(How to iterate over variable in param using JSF EL expression)
  • 是否有可能在WPF中的一个单独的进程中隔离一些控件?(Is it possible to isolate some controls in a separate process in WPF?)
  • 使用Python 2.7的MSI安装的默认安装目录是什么?(What is the default installation directory with an MSI install of Python 2.7?)
  • 寻求多次出现的表达式(Seeking for more than one occurrence of an expression)
  • ckeditor config.protectedSource不适用于editor.insertHtml上的html元素属性(ckeditor config.protectedSource dont work for html element attributes on editor.insertHtml)
  • linux只知道文件名,不知道在哪个目录,怎么找到文件所在目录
  • Actionscript:检查字符串是否包含域或子域(Actionscript: check if string contains domain or subdomain)
  • 将CouchDB与AJAX一起使用是否安全?(Is it safe to use CouchDB with AJAX?)
  • 懒惰地初始化AutoMapper(Lazily initializing AutoMapper)
  • 使用hasclass为多个div与一个按钮问题(using hasclass for multiple divs with one button Problems)
  • Windows Phone 7:检查资源是否存在(Windows Phone 7: Check If Resource Exists)
  • 无法在新线程中从FREContext调用getActivity()?(Can't call getActivity() from FREContext in a new thread?)
  • 在Alpine上升级到postgres96(/ usr / bin / pg_dump:没有这样的文件或目录)(Upgrade to postgres96 on Alpine (/usr/bin/pg_dump: No such file or directory))
  • 如何按部门显示报告(How to display a report by Department wise)
  • Facebook墙贴在需要访问令牌密钥后无法正常工作(Facebook wall post not working after access token key required)
  • Javascript - 如何在不擦除输入的情况下更改标签的innerText(Javascript - how to change innerText of label while not wiping out the input)
  • WooCommerce / WordPress - 不显示具有特定标题的产品(WooCommerce/WordPress - Products with specific titles are not displayed)