I have built a very simple CakePHP website using the Auth component and have stumbled across a very annoying bug. Basically if a user tries to access an area that they are required to login to first they are taken to a login page and then sent back to the original page if they successfully login… this is all fine and dandy but because this remembrance of where the user tried to go is stored in a session it hangs around so if I ended up at the login page then decided to go elsewhere then comeback and then GO DIRECT to the login form it will send me to the page I tried to access earlier on as it’s still being stored in the session.
How do I stop this? As it means users are being sent to random pages when they login from the login page if they tried to access the site previously.
This isn’t a bug. This is intended, documented behavior.
Fortunately, CakePHP is well documented. Can check out the 1.3 book that details the variables needed to change default Auth behavior, specifically
$this->Auth->autoRedirectproperty.