This isn’t only experienced by you, there are other users who may have experienced the same issue as you have. To solve the auto logout from the Presta Shop admin, we have listed the codes to solve this problem. This fix basically removes the IP checking that Presta Shop has, allowing you to fix the login problem.
There are some ISPs (Internet Service Providers) have cache/proxy/firewall that may not represent your IP accurately. What happens is that Presta Shop is more secure by tagging your login session with your IP address and constantly checks for it when you’re logged in to the admin panel.
Click on the links to skip through on the versions of Presta Shop. You will need to edit file: prestashopfolder/classes/cookie.php
Prestashop Version 1.3
Find the “Before” line and edit the code by removing everything after the second “AND” in bold:
Before
if ($this->id_employee AND Validate::isUnsignedId($this->id_employee) AND Employee::checkPassword(intval($this->id_employee), $this->passwd) AND (!isset($this->_content[‘remote_addr’])OR $this->_content[‘remote_addr’] == ip2long(Tools::getRemoteAddr()))) |
After
Once it is removed, copy this after code:
if ($this->id_employee AND Validate::isUnsignedId($this->id_employee) AND Employee::checkPassword(intval($this->id_employee), $this->passwd)) |
Make sure to save the changes made.
Prestashop Version 1.4
Find the “Before” code:
Before
AND (!isset($this->_content[‘remote_addr’]) OR $this->_content[‘remote_addr’] == ip2long(Tools::getRemoteAddr())) |
After
Add two forward slash (//) in front of the line code or “AND”:
//AND (!isset($this->_content[‘remote_addr’]) OR $this->_content[‘remote_addr’] == ip2long(Tools::getRemoteAddr())) |
Make sure to save the changes made.
For Prestashop Version 1.4.7 and above
You will need to log in to the Prestashop admin, click on Preference and set No for “Check IP on the cookie”. Once you’re done, the auto logout trouble should stop.
Note: You can secure your Presta Shop admin folder by using the Password Protect Directories feature on your admin folder. If you have a static internet line, it is also a good idea to deny any other IP address other than yours using the .htaccess or IP Blocker. |
If you have further queries, please don’t hesitate to contact our 24/7 Singapore or Australia Support Team.