Jump to content

Prevent being logged out from back-office


Recommended Posts

Prestashop has an annoying feature that logs you out from the back-office if you do nothing for a certain amount of time (for security reasons, I suppose). I thought this behaviour was configurable from the Preferences panel, with COOKIE LIFETIME BO. So I set it to 24 (1 day), but it still gave me problems. After investingating the code, I found that the amount of time is actually hardcoded in the source, in the file root/classes/controller/AdminController.php  and set to 900 seconds (15 mins).


Here’s the code:



if ($this->context->cookie->last_activity + 900 < time())
$this->context->employee->logout(); 

All I needed to do was change that to something higher (say 4*3600 = 4 hours) and I still have security, without the pains.


Here's a link to a blog post I wrote about this.


  • Like 2
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...