i have a log in page where user enters username and password and then the user is redirected to his account page, but when i press the back button it takes me back to the log in page. How do i prevent that from happening.
Asked
Active
Viewed 2,905 times
1
-
Do you have some sample code? What have you tried? There is not enough information here to answer this question. – Steve Jun 06 '13 at 09:47
-
i am using auth component of cakephp, its a simple code of login checking and redirect – user2265771 Jun 06 '13 at 09:59
2 Answers
0
You should add checking if user is logged in on login page. If yes, you should make redirection to default page.
Vitalii Pro
- 313
- 2
- 17
-
1there is checking, but its like the log in page is cached in the browser after login, and on click of back just display the cache page. Reloading of page does not happen when back button is pressed. – user2265771 Jun 06 '13 at 09:56
-
if when back button is clicked and i am on log in page and refresh the page it redirects me to the users account page – user2265771 Jun 06 '13 at 09:58
-
You can disable browser cashing for login page. http://stackoverflow.com/questions/1341089/using-meta-tags-to-turn-off-caching-in-all-browsers – Vitalii Pro Jun 06 '13 at 11:39
-
its already implemented, but still it takes you back to log in page – user2265771 Jun 06 '13 at 12:20
0
In your controller (where you check if user is valid or not), make a session variable and initialise it to "connected" for example.
And in your login form check if your session variable is connected if so redirect to wanted page.
Artjom B.
- 61,146
- 24
- 125
- 222
Yassine Elhamraoui
- 145
- 4
- 17