douqiang7462 2016-10-06 08:13
浏览 20
已采纳

symfony2如何通过身份验证访问用户凭据/信息?

Once I've logged a user via a firewall setting redirecting them to a login page... how do I access their data? Is that even possible.

My issue is I've got a login for that apparently works, but keeps just showing the login form over and over... I can't get any errors as to what's happening behind the scenes..

How can I add errors to my login form to see what's failing and why.

  • 写回答

1条回答 默认 最新

  • douluo5937 2016-10-06 11:50
    关注

    Are you sure that you are displaying the errors messages on your template?

    The common practice would be to use something like the code fragment below to display the error message

    {% if error %}
      <p>{{error.messageKey|trans(error.messageData, 'security') }}</p>
    {%  endif %}
    

    But you might even want to use the dump function just to see if the error object has any information that is useful.

    You might as well want to extend the AbstractFormLoginAuthenticator and implement its methods.

    This is a good tutorial that might help you

    http://www.sensiolabsblog.co.uk/blog/symfony-security-component-guard-tutorial

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 esp8266控制共阳极wrgb灯板无法关闭所有led灯
  • ¥100 python读取速度问题
  • ¥15 stm32f407使用DMA问题
  • ¥15 您好 这个API接口该怎么弄 网站搭建好了 API也有 现在就不知道该怎么填写API 不知道怎么用
  • ¥88 用uniapp写一个多端的程序,用到高德地图,用高德的JSAPI吗?
  • ¥20 关于#c++#的问题:水果店管理系统
  • ¥30 dbLinq最新版linq sqlite
  • ¥20 对D盘进行分盘之前没有将visual studio2022卸载掉,现在该如何下载回来
  • ¥15 完成虚拟机环境配置,还有安装kettle
  • ¥15 有人会搭建生鲜配送自营+平台的管理系统吗