Reading Time: 3 minutes

Prestashop has quite strict security features and one of these is certainly the duration of the session timeout, which is rather short. This ploy is to reduce your application’s exposure to session-based attacks, such as session cookie theft.

However, this can be quite annoying for anyone who is working with the platform. Store admins may be logged out of the admin interface if they are idle for some time. This can be very frustrating.

Today then I’ll show you why it happens and how to fix this error.

Prestashop-login

Prestashop Admin Login Problem – Where do you see this error?

This problem usually occurs when one of these conditions occurs:

  • Prestashop admin panel logs out the admin while updating the product settings.
  • The Prestashop store owner cannot log in, no matter how many times the browser cache is cleared.
  • Prestashop admin panel disconnects the owner after a few minutes of inactivity.

Prestashop admin login problem: 3 reasons

Let’s see what are the 3 main reasons why the Prestashop admin login problem occurs.

  • Maximum duration of inactivity set – “Admin Controller” manages the back office functions in Prestashop. The default cookie inactivity period is set to 15 minutes in this file. You will be removed from the admin panel after 15 minutes of inactivity.
  • Use of the dynamic IP address: when you are in the Prestashop administration panel, this system protects the session by tagging your login session with your IP address (via authentication cookie). Constantly check this IP address. If your IP address changes, it will invalidate the cookie and ask you to log in again.
  • Incorrect Values ​​for “PS_SHOP_DOMAIN” and “PS_SHOP_DOMAIN_SSL” – Wrong domain name provided for PS_SHOP_DOMAIN and PS_SHOP_DOMAIN_SSL in the ps_configuration table.

Prestashop admin login problem: how to fix this error?

To solve this problem, we mainly use 5 different ways, based on the exact problem the store owner is facing.

But before you get into the details and make any changes to the store, make sure you have the database and website files backed up.

1. Clear your browser cache and cookies

To check this, try to log in from another browser or activate the “Incognito mode”.

2. Clear the 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 / compil

3. Correct the domain name saved in the database

Provide the correct domain name for PS_SHOP_DOMAIN and PS_SHOP_DOMAIN_SSL in the ps_configuration table.

You should only provide the domain name. For example: your shop URL is http://test.com/store/, you should provide values ​​like:

PS_SHOP_DOMAIN = test.com
PS_SHOP_DOMAIN_SSL = test.com

The installation directory should be indicated in the “ /config/setting.inc.php “ file.

4. Disable IP address checking

Remove the check of the user’s IP address performed by Prestashop.

You can disable it in the “ classes / cookie.php ” file inside the “ isLoggedBack () “ function.

Here, remove or comment on the following condition.

! Configuration :: get (‘PS_COOKIE_CHECKIP’))

5. Increase the period of inactivity of cookies

The inactivity period is set to 15 minutes by default.

You can increase this value in the “ classes / controller / AdminController.php “ file.

Look for the following code in the file:

if (time $ this-> Context> cookie-> last_activity + 900 <())

Here the inactivity period is set to 900s (15 minutes). You can replace this value in seconds.

Andrea Saccà
FOUNDER Bhoost Hosting

Sharing tips and insights on Bhoost and Page Speed Optimization