Prestashop admin login problem – Causes and Fix
Prestashop has stringent security features. One such feature is Short Session timeouts.
This is to reduce the exposure of your application to session based attacks like session cookie theft.
However, this can cause issues even for legitimate users.
Store admins could get kicked out of the admin interface if they remain inactive (say by attending a call) in the middle of a store update. It can be very frustrating.
We’ve seen many causes for this error as part of our Dedicated Support Services, where we manage tech support desk of web hosts.
Today, let’s discuss when we see this error, why and how we can fix it.
When do we see this error?
Prestashop owners cite broadly 3 situations in which this issue happens:
- Prestashop admin panel kicks out the administrator in the middle of updating product settings (yes, no reason at all).
- Store owner cannot login, no matter how many times the browser cache is cleared. Prestashop keeps showing the login page again & again.
- Prestashop admin panel logs out the owner after a few minutes of inactivity.
What causes Prestashop admin login problem?
Let’s discuss the top 3 reasons for this problem.
- Maximum duration of inactivity set – “Admin Controller” manages Backoffice functionalities in Prestashop. The default cookie inactivity period is set to 15 mins in this file.You’ll be kicked out of the admin panel after 15 mins of inactivity.
- Use of dynamic IP address – When you are in Prestashop admin panel, it secures the session by tagging your login session with your IP address(via authentication cookie). It constantly checks for this IP address. If your IP address changes, it will invalidate the cookie and and ask you to re-login again.
- Incorrect values for “PS_SHOP_DOMAIN” and “PS_SHOP_DOMAIN_SSL” – Incorrect domain name given for PS_SHOP_DOMAIN and PS_SHOP_DOMAIN_SSL in the table ps_configuration.
How we can fix this error?
To fix this, we primarily use 5 different ways, based on the exact issue the store owner is facing.
But before we get into the details, and you make any changes to the store, make sure that you have the backup of your database and website files.
1. Clear your browser cache and cookies
To verify this try to access from another browser or turn on ‘incognito mode’.
2. Clear cache in Prestashop
The cache files are located in these locations.
Go to these folders and delete all the files in them.
- OR /tools/smarty_v2/cache
- OR /tools/smarty_v2/compile
3. Correct the domain name saved in database
Give the correct domain name for PS_SHOP_DOMAIN and PS_SHOP_DOMAIN_SSL in the table ps_configuration.
You should give the domain name only. For eg: your store URL is http://test.com/store/, you should give the values as:
PS_SHOP_DOMAIN = test.com
PS_SHOP_DOMAIN_SSL = test.com
The install directory should be given in the file “/config/setting.inc.php“.
4. Disable IP address check
Remove the user’s IP address check done by Prestashop.
You can disable it in the file “classes/cookie.php” inside the function “isLoggedBack()“.
Here, remove or comment the following condition.
5. Increase the cookie inactivity period
The inactivity period is set as 15 mins by default.
You can increase this value in the file “classes/controller/AdminController.php“.
Look for the below code in the file:
if (time $ this-> Context> cookie-> last_activity + 900 <())
Here the inactivity period is set as 900s(15 mins). You can replace this value in seconds.
Prestashop admin login problem is a common issue that store owners can come across. Today, we have discussed the top reasons for this error and how our Dedicated Support Engineers fix them.