Redirection problem after login (symfony1.4)
某草草
某草草 2017-05-16 16:44:22
0
2
455

The configuration file setting of the page requires login before browsing,
I hope to be redirected directly back to this page after logging in,
But in the action on the login page, I cannot get the Referer before login. How to deal with this situation?

某草草
某草草

reply all(2)
淡淡烟草味

When you are not logged in, the page that requires login will be redirected to the login page. At this time, the previously requested URL will be saved in the session.
If you go to the / route after logging in, you need to go to security

# app/config/security.yml
security:
    firewalls:
        main:
            form_login:
                # ...
                default_target_path: default_security_target

When the login fails, the requested URL will be saved under default_secutrity_target. In other cases, the default is /

过去多啦不再A梦

What you mean is that when a non-logged-in user visits any page that requires login, he or she will be redirected to the login page. After successful login, he or she will be redirected back to the page he originally wanted to visit, right?

Get the referer when the user is redirected to the login page for the first time. When the user login form is submitted to the login page, pass this referer, such as using hidden input, and jump to the referer after successful login; if the login fails, then Return to the login page and pass the referer again. (Loop the above operations)

The login process will be much simpler if you use ajax

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template