doutidi5037 2014-05-24 08:18
浏览 35
已采纳

如何注销会话Symfony Fos:Userbundle

I am new to Symfony2, i am using FOSUserBundle. I overwrote the default template for the FOSUserBundle, and doing so i have lost the 'loggout' link on the profile page at

             resource: "@FOSUserBundle/Resources/config/routing/profile.xml" 

Is there a way to loggout from the symfony tool bar at the bottom?

and what is the resource link to loggout a user in fosUserBundle

  • 写回答

1条回答 默认 最新

  • dongqiao9583 2014-05-25 07:06
    关注

    I think, that the default route for logout in FOSUerBundle is "fos_user_security_logout", so you can generate a logout link anywhere in your site with this route:

    <a href="{{ path('fos_user_security_logout') }}">
    

    It is also possible to add a new block to the Symfony2 debug toolbar with the logout link. You should have a look here: Adding Web Profiler Templates

    You can extend the 'WebProfilerBundle:Profiler:layout.html.twig' layout and add the custom content to the toolbar block.

    {% block toolbar %}
        {# the web debug toolbar content #}
    {% endblock %}
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!
  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?
  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮