「已注销」 2015-04-10 07:35
浏览 16
已采纳

FOS用户捆绑包从登录获取POST数据

I'm trying to integrate the new Google recaptcha into the FOS User Bundle Login.

I've successfully overwritten the login template and the SecurityController form FOS where the loginAction() happens.

The problem I'm facing is that I can't access the send POST Data from the Login Form anywhere in the Controller. I tried it in the loginAction() and in the checkAction(), neither of them had the POST Data in the request.

So I'm guessing that there's a service, listener or something else that does a redirect or something else so that the POST data get lost.

Where can I access the POST Data that will be send to the server from the Login Form?

  • 写回答

1条回答 默认 最新

  • dongxu1875 2015-04-10 07:57
    关注

    I found the answer within my source code after I drank a cup of coffee and rethought the problem.

    You can access the Data, that has been sent from the login Form, with a listener that listens on the login event. This is the listener I configured in my services.yml

    project.LoginListener:
        class: namespace\Listener\LoginListener
        arguments: [@doctrine,@session,@security.context,@project.someService]
        tags:
            - { name: kernel.event_listener, event: security.interactive_login, method :onSecurityInteractiveLogin }
    

    Within the listener you can easily access the sent data in the paramter bag of the request. The request is accessable through the event that's given within the listener.

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

报告相同问题?

悬赏问题

  • ¥30 python代码,帮调试
  • ¥15 #MATLAB仿真#车辆换道路径规划
  • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建
  • ¥15 数据可视化Python
  • ¥15 要给毕业设计添加扫码登录的功能!!有偿
  • ¥15 kafka 分区副本增加会导致消息丢失或者不可用吗?
  • ¥15 微信公众号自制会员卡没有收款渠道啊
  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条