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 metadata提取的PDF元数据,如何转换为一个Excel
  • ¥15 关于arduino编程toCharArray()函数的使用
  • ¥100 vc++混合CEF采用CLR方式编译报错
  • ¥15 coze 的插件输入飞书多维表格 app_token 后一直显示错误,如何解决?
  • ¥15 vite+vue3+plyr播放本地public文件夹下视频无法加载
  • ¥15 c#逐行读取txt文本,但是每一行里面数据之间空格数量不同
  • ¥50 如何openEuler 22.03上安装配置drbd
  • ¥20 ING91680C BLE5.3 芯片怎么实现串口收发数据
  • ¥15 无线连接树莓派,无法执行update,如何解决?(相关搜索:软件下载)
  • ¥15 Windows11, backspace, enter, space键失灵