0

Currently, under Symfony2, when user is logging in, there is redirection to homepage. Is there a way to do no redirection and stay at the current page ?

Thanks.

Here is the security part

firewalls:
    dev:
        pattern: ^/(_(profiler|wdt|error)|css|images|js)/
        security: false

    main:
        pattern: ^/
        anonymous: true
        provider: user
        form_login:
            login_path: /
            always_use_default_target_path: false
            default_target_path: /
            check_path: /securite/connexion/check
        logout:
            path: app_security_logout
            target: app_homepage
Yohann
  • 265
  • 1
  • 8
  • 17

2 Answers2

0

You could redirect to the referer:

# app/config/security.yml security:

firewalls:
     main:
         form_login:
             # ...
             use_referer:        true

More info can be found here: http://symfony.com/doc/current/cookbook/security/form_login.html

FWrnr
  • 361
  • 1
  • 6
0

And you can do with ajax and fosuserbundle (for example) with this

Symfony 2 FOS User Bundle Bootstrap modal AJAX Login

Community
  • 1
  • 1
Héctor Prats
  • 273
  • 3
  • 14