So the crux of this question is just how to prevent CakePHP from de-authenticating a session ONLY after a period of inactivity.
So, if the user does nothing then I expect CakePHP to log them out after a period of 30 minutes. However, if the user chooses to visit a page on the 28th minute of inactivity, then CakePHP should 'reset' it's timeout counter.
This currently isn't happening. Regardless of activity, CakePHP times out after the specified time in my core configuration (app/Config/core.php).
Here's my config code:
Configure::write('Session', array( 'defaults' => 'cake', 'timeout' => '30' ));
Any ideas?
After running into the same problem I've found that this was caused by the Session.cookieTimeout value. Although the php session was still valid, the expiration date on the session cookie does not get refreshed.
This is now my session config
Configure::write('Session', array( 'defaults' => 'php', 'timeout' => 30, // The session will timeout after 30 minutes of inactivity 'cookieTimeout' => 1440, // The session cookie will live for at most 24 hours, this does not effect session timeouts 'checkAgent' => false, 'autoRegenerate' => true, // causes the session expiration time to reset on each page load ));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With