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 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.
Prestashop admin login problem – Where do you see this error?
Website 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).
- Prestashop store owner cannot login, no matter how many times the browser cache is cleared. It keeps showing the login page again & again.
- Prestashop admin panel logs out the owner after a few minutes of inactivity.
Top 3 reasons for 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.
Prestashop admin login problem – How to 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 browser cache and cookies
To verify this try to access from another browser or turn on ‘incognito mode’.
2. Clear Prestashop cache
The cache files are located in these locations.
Go to these folders and delete all the files in them.
- /tools/smarty/cache
- OR /tools/smarty_v2/cache
- /tools/smarty/compile
- 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
Copy Code
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.
!Configuration::get('PS_COOKIE_CHECKIP'))
Copy Code
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 <())
Copy Code
Here the inactivity period is set as 900s(15 mins). You can replace this value in seconds.
Conclusion
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 Support Engineers fix them.
Hi i have this problem. Also the clients have similar problems. They cant login and when they click checkout they re directed to homepage. Is this related?
Yes Ozgur, it can be related.
If you still have errors and need help, we’ll be happy to talk to you on chat (click on the icon at right-bottom).