0

I have simple login/register app written in symfony2. I am using db encoder for checking user/password combination. And that part is working great.

I have a problem during login. I do not understand login_check path? Where is controller for that?

I need to catch plain password during user login so I can pass that username and plain password to php xmpp namespace which will check user/pass at openfire server.

Please tell me if I have wrong approach for this. I really need some guidance.

Please advise.

pregmatch
  • 2,629
  • 6
  • 31
  • 68

2 Answers2

1

Please see my answer to a similar question for a quick introduction to the special "route" form_login.check_path

Community
  • 1
  • 1
Nicolai Fröhlich
  • 51,330
  • 11
  • 126
  • 130
  • I am using default user_db, entity User, as for your manual, do you mean that I have to switch to new provider service in order to access data that I need username/plain password? – pregmatch Oct 25 '13 at 22:55
  • what do you mean by default user_db ? – Nicolai Fröhlich Oct 25 '13 at 23:00
  • my security provder is providers: user_db: entity: { class: Chat\IndexBundle\Entity\User, property: username} – pregmatch Oct 25 '13 at 23:07
  • is there any way that i can to some sort of pre-auth action first? – pregmatch Oct 25 '13 at 23:49
  • thank you for your help, but i used event listener that fires on user login. i added answer. – pregmatch Oct 26 '13 at 00:22
  • Glad you were able to figure it out yourself. You might consider showing some appreciation by at least upvoting my answer. it clearly provides the answer for the `I have a problem during login. I do not understand login_check path? Where is controller for that?` part of your question and probably hinted you into the right direction towards your solution. happy coding :) – Nicolai Fröhlich Oct 26 '13 at 11:48
1

I figured this out by adding an event listener that fires on user login.

services.yml

services:
    d_user.login_listener:
      class: Chat\IndexBundle\EventListener\LoginListener
      arguments: []
      tags:
        - { name: 'kernel.event_subscriber', event: 'security.interactive_login' }

and listener

namespace Chat\IndexBundle\EventListener;

use Symfony\Component\Security\Http\Event\InteractiveLoginEvent;

use Symfony\Component\EventDispatcher\EventSubscriberInterface;

class LoginListener implements EventSubscriberInterface
{
    public function onSecurityInteractiveLogin(InteractiveLoginEvent $event)
    {
        die(var_dump($event->getRequest()));

    }
    //...etc

}

in that die(var_dump($event->getRequest())); now I can catch user and pass and pass it to openfire server from which i can get sid, rid and jid and attach to that session on frontend.

this answer was very helpful.

Community
  • 1
  • 1
pregmatch
  • 2,629
  • 6
  • 31
  • 68