0

I have used FOSUserBundle and HWIOAUTH for register and login. I have two types of register and login URL with query params and without params. If Url login and register through params then I want to redirect to Payment Gateway.

Is there any success handler event?

How can I achieve this? Thanks in advance.

security.yml

social:
        pattern: ^/            
        form_login:
            provider: fos_userbundle
            csrf_token_generator: security.csrf.token_manager
            login_path: fos_user_security_login
            check_path: fos_user_security_check
            default_target_path: user_bundle_homepage
            #use_forward:    false
            success_handler: my.authentication_success_handler
            #failure_handler: my.authentication_failure_handler
        oauth:
            resource_owners:
                facebook: "/login/check-facebook"
                google: "/login/check-google"
            login_path: fos_user_security_login
            failure_path: fos_user_security_check
            default_target_path: user_bundle_homepage
            oauth_user_provider:
                #this is my custom user provider, created from FOSUBUserProvider - will manage the
                #automatic user registration on your site, with data from the provider (facebook. google, etc.)
                service: my_user_provider
            success_handler: my.authentication_success_handler
        logout:
            path:   fos_user_security_logout
            target: fos_user_security_login
        anonymous: true`
Kirit
  • 405
  • 3
  • 18

1 Answers1

0

Hello you can do it with override FOS\UserBundle\Controller\RegistrationController and insert your logic in registerAction. https://symfony.com/doc/current/bundles/FOSUserBundle/overriding_controllers.html

l13
  • 529
  • 3
  • 11
  • I am working with social login for that I have used HWIOauth bundle. Registration action is performed through HWIOauth bundle. – Kirit Feb 26 '18 at 06:50
  • Try to create litener on kernel.response event and insert your logic for request url (redirect for specific situation or etc....) – l13 Feb 26 '18 at 07:07
  • In the end, I did the same thing and make working now, but looking for the better way if is there any. – Kirit Feb 26 '18 at 07:22
  • I am not try this but I think that it's work: first -> php app/console sonata:easy-extends:generate HWIOAuthBundle -d src after that override ConnectController and insert your logic – l13 Feb 26 '18 at 07:35