I have the following problem that I couldn’t find any solution for.
I have a simple custom login page, which I’ve managed to set up, so it redirects to the referred URL the user came from. The problem is, when user fails to authenticate – yes, s/he still stays on the same custom page, but the original referrer is lost, and now is replaced with the same custom-login page the user is currently on.
In short, what I want to achieve is:
- User clicks the link to the document and sees the info that he has to login first to see it.
- User goes to the login page, with HTTP_REFERRER set properly to the page he came from.
- User types wrong password and is kept on the same login page, with the original HTTP_REFERRER so that after he types in the correct password, he will be redirected to the original page he came from, instead of seeing the empty login page.
I’ve managed to do it with the proper login process, but it looks way harder when the page refreshes and loses its original referrer…