简体   繁体   English

Symfony Change渲染登录FosUserBundle

[英]Symfony Change render login FosUserBundle

I use this in my navbar on my web site 我在网站的导航栏中使用它

{{ render(controller('FOSUserBundle:Security:login')) }}

And i put the login form in my navbar where my login work when i put the correct data into.. my problem come when the data is incorrect because the render redirect me on the login.html.twig page for say me the error message. 然后,我将登录表单放在导航栏中,当我将正确的数据放入其中时,我的登录工作就会开始..当数据不正确时,我的问题就来了,因为渲染将我重定向到login.html.twig页面,向我说错误消息。 I think my problem is in this lines 我认为我的问题在于

     protected function renderLogin(array $data)
       {
      return $this->render('FOSUserBundle:Security:login.html.twig', $data);
    }

I try to change this, with the initial page or the directory of navbar but is not the good way.. 我尝试用初始页或navbar的目录更改此设置,但这不是好方法。

How can i do??? 我能怎么做??? I want the error message in the index and I do not want to redirect the login page.. 我想要索引中的错误消息,并且我不想重定向登录页面。

I personally had this problem; 我个人有这个问题。 You can either override the login function of FOS, and handle the error when there's any, or do as i did, and create an ajax call for the login, and handle it yourself 您可以覆盖FOS的登录功能,并在有错误时处理错误,或者像我一样做,为登录创建ajax调用,然后自己处理

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM