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 关于#极限编程#的问题,请各位专家解答!
  • ¥20 win11账户锁定时间设为0无法登录
  • ¥45 C#学生成绩管理系统
  • ¥15 VB.NET2022如何生成发布成exe文件
  • ¥30 matlab appdesigner私有函数嵌套整合
  • ¥15 vb6.0使用jmail接收smtp邮件并另存附件到D盘
  • ¥30 vb net 使用 sendMessage 如何输入鼠标坐标
  • ¥15 关于freesurfer使用freeview可视化的问题
  • ¥100 谁能在荣耀自带系统MagicOS版本下,隐藏手机桌面图标?
  • ¥15 求SC-LIWC词典!