0

I'm trying to get the following behavior, but it's not working:

If a user goes to http://example.com/addresses he should get redirected to the Craft login form. So the corresponding template has a {% requireLogin %} tag. After a successful login the user should be redirected to the page he was trying to access (in the case http://example.com/addresses)

Without any additions to the config array the redirect goes to http://example.com/login which is a 404 page.

If I add the loginPath setting to the config file and set it to 'admin/login' it redirects to the correct Craft login form, but after login it's not going to /addresses but /admin/addresses

What settings would lead to the desired behavior?

2

You should create your /login template with a custom login form. If you do that, the redirect should work as expected:

craft.session.returnUrl is set to the original URL that included the {% requireLogin %} tag that initiated the redirect to this login form.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.