Jump to content

[SOLVED] Admin Login Problem


Recommended Posts

I have been surfing the entire forum and it seems the developers did not answer any of the problems on this issue.
I tried everything from cookie changing to clearing smarty cache, clear cookies

and I think I know what's the real problem

I called my friend of mine and he mention it has to do with the internet provider you use and
the way they design and assign the ip address to your computer that is causing this problem.

So I tried to switch internet connection provider and surprisingly the log out problem disappear.

However I think this is kind of stupid if I keep on changing to a slower internet connection that
only works with prestashop admin login.

I hope the developers are reading this and find a way to solve this issue by reducing the security
features on the scripts and not tagged it based on ip address but based on cookie

Link to comment
Share on other sites

If the root of the problem lies with the internet provider, then it's a very big issue. Why? Because most of the users' ip addresses assigned are dynamic ip and ip addresses are already used up. Dynamic IPs keep changing and this is not in any user's control, which means more and more Prestashop users will have this problem as internet providers use dynamic ip addresses to address/tackle ip address shortage.

If Prestashop's security or login session is really caused by ip address, I strongly suggest that it's time to change. It's really frustrating to get logged out without warning in the middle of updating information or drafted a long list of stuff and ended up not getting saved. What I can say is, more people will think twice about using Prestashop if this is true.

I hope developers are really looking into this problem because I've observed more cases have surfaced of late (since start of new year).

Link to comment
Share on other sites

the problem is confirm it's the ip address assigned by internet provider as I have tested it for 2 hours on two different internet connections and one of them keeps on logging me out....

I do hope the developers will read this thread and do something about it...

and the strange part is that the customer login works fine.. it's only the admin login has this logging out problem due to the way internet provider assign the ip address to us.

Link to comment
Share on other sites

Yes, it's strange too. I registered a customer test account and logged in as a customer using the same internet connection and ip. The customer account doesn't have the logging out problem but the admin account does.

Update: I have discussed this issue with another user who is using the same web host and this is the excerpt of the reply from the web host:

Good day, this issue is only applicable to SH (an ISP) users, this is likely something to do with the caching server at SH's end. Reason being, the prestashop should be authenticating with the IP I would believe, this thus caused the auto logout issue because the cookie was not registered correctly.
  • Like 1
Link to comment
Share on other sites

Hi All,

While troubleshooting the issue, found a thread that talks about the cookie, not sure if this helps.

http://www.prestashop.com/forums/viewthread/51694/

In the file “prestashop/classes/Cookie.php” go down to line 50 where you see:

$this->_expire = isset($expire) ? intval($expire) : (time() + 1728000);
and change it too:

$this->_expire = isset($expire) ? intval($expire) : (time() + 3600);

Link to comment
Share on other sites

Hi,

How about this? It seems to work for me now, going to test again tomorrow to confirm.

http://www.vodien.com/support/96/prestashop-auto-log-out-issue.html

Quoted from the site:

File: classes/cookie.php
Comment the first line and add the new line, basically removing the IP checking.

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
if ($this->id_employee AND Validate::isUnsignedId($this->id_employee) AND Employee::checkPassword(intval($this->id_employee), $this->passwd))

Take note that the ending have 2 "))", some users will accidentally delete too many of them and get a blank page.

For some ISPs, they actually go through a caching server/proxy server/firewall at times for security checks or just for network acceleration. When such systems are in place, the IP of the visitor may not be represented accurately, because some systems may detect the intermediate device's IP or the visitors real IP.

Here is an example, tested with Starhub:
Basically if you try to access this page, and if you happen to be starhub user, you will notice that if you go to the first IP query page check your IP, it show different result from the second link. Basically the whole issue above is due to the IP that was presented to the server for authentication, and the mis-match causes the auto log out.

http://whatismyipaddress.com/ shows you the real IP address
http://www.whatismyip.com/ shows you your proxy's IP address (Note that not all users will see the IP different from the above URL, basically they use a different checking mechanism)

So what exactly happen in Presta is that it tries to be very secure, but tagging your IP to your authentication cookie, and of course checks for it again in the admin page to make sure it is correct before allowing you to continue staying in the admin area.
Link to comment
Share on other sites

I tested the solution on PS v1.4.0.11 and it doesn't work. I still get logged out and when I modified (deleted the "remoteAdd" line) codes, I get a white blank page when trying to login.

I think it has to do with the core codes in the /class/cookie.php and /admin/login.php files. Both contain the code lines

AND (!isset($this->_content[‘remote_addr’]) OR $this->_content[‘remote_addr’] == ip2long(Tools::getRemoteAddr())))



However 1.4 logouts are not as frequent as I had with 1.3.6.

Link to comment
Share on other sites

Initially when I deleted the lines, I deleted too many )) and I got a blank page too, could you have deleted too many )) as well?

Try deleting the whole chunk of codes, and put this

if ($this->id_employee AND Validate::isUnsignedId($this->id_employee) AND Employee::checkPassword(intval($this->id_employee), $this->passwd))


Make sure you check that you should end with 2 )) instead of 1, I made this mistake yesterday, hope that helps.
Link to comment
Share on other sites

I tried it myself and modify the code to

if ($this->id_employee AND Validate::isUnsignedId($this->id_employee) AND Employee::checkPassword(intval($this->id_employee), $this->passwd))


and it works just fine.. if you are making changes to the code ensure you do not have any typo errors if not I think it will go blank.. or maybe you just need to refresh your browser and clear to cache to ensure you are looking at the latest changes to your website.

Thanks Vodien for solving this problem, FINALLY A SOLUTION found! By the way vodien has great support would highly recommend :)
Link to comment
Share on other sites

I feel the administration should sticky this thread.. and by the way for those who are making the changes do take note by changing the code.. it just reduces the security of the admin login by not checking your ip address but will still require a cookie to login which is still quite safe :)

Link to comment
Share on other sites

The modfications work fine for version 1.3. But the codes are slightly different in 1.4's cookie.php file and similar code lines are also found in /admin/login.php file as well.

What I mentioned (code modifications don't work as expected) in my earlier post #11 is for PS 1.4.
When I deleted the codes that check with IP for admin login in both files, I can load the login page but I can't login. If I delete the code from just the /classes/cookie.php file, I get a blank white login page.

I'll try to test some other code modifications and see if they work.

Link to comment
Share on other sites

I have also installed 1.4 to try and indeed it does not work, I have reported to my host Vodien to seek assistance.

I am waiting for them to get back to me, hopefully they have a solution as well.

The modfications work fine for version 1.3. But the codes are slightly different in 1.4's cookie.php file and similar code lines are also found in /admin/login.php file as well.

What I mentioned (code modifications don't work as expected) in my earlier post #11 is for PS 1.4.
When I deleted the codes that check with IP for admin login in both files, I can load the login page but I can't login. If I delete the code from just the /classes/cookie.php file, I get a blank white login page.

I'll try to test some other code modifications and see if they work.
Link to comment
Share on other sites

I was told all we need is to delete/comment this line away, the problem will fly again.

Applicable to V1.4, for V1.3, refer to page one of thread.

Edit File: /classes/cookie.php
Code can be found on line 195

Before

AND (!isset($this->_content['remote_addr']) OR $this->_content['remote_addr'] == ip2long(Tools::getRemoteAddr()))



After

//AND (!isset($this->_content['remote_addr']) OR $this->_content['remote_addr'] == ip2long(Tools::getRemoteAddr()))



Reference to code from http://www.vodien.com/support/96/prestashop-auto-log-out-issue.html

  • Like 1
Link to comment
Share on other sites

Great news! The newly released 1.4RC3 now has IP checking feature set as optional!

Update: Still get auto logged out in 1.4RC3 when IP checking on cookie is set to "NO", but not that frequent.

Update 2: Modify the codes as below

For Version 1.4
Before

AND (!isset($this->_content['remote_addr']) OR $this->_content['remote_addr'] == ip2long(Tools::getRemoteAddr()))



After (Only need to add // in front of the line mentioned above)

//AND (!isset($this->_content['remote_addr']) OR $this->_content['remote_addr'] == ip2long(Tools::getRemoteAddr()))



Update 3: The code modifications above do not work. Please download and use the 2 files attached in post 21.

Link to comment
Share on other sites

Hi Guys,

The problem still exist - i can't even log in now! :(
as mention on the guide, what i did was just add in the // on the first sentence but when i open it out and paste as it is.

Yet when i click on my website - it's blank!?

What are the step did i do wrong?

Also i notice that when i add in // on the first sentence, it's mention there a error on it.

how can i fix it? (My number was on line 165 instead of the line 195

Appreciate anyone able to help? Thanks!

Link to comment
Share on other sites

Ok i have instaled version 1.3.6 and the code change you have posted aint work :/

Also, i instaled 1.4RC3 for test purpuoses and that 2 files to overwrite from post 21 also aint solve myt problem. I've still got logged out at random circuimstances.

Link to comment
Share on other sites

After you logged in to admin, works a while, then after that you get logged out automatically?

If that is the same issue you faced, could you share more details like what is your ISP? Not all login problems has something to do with this cookie IP.

Ok i have instaled version 1.3.6 and the code change you have posted aint work :/

Also, i instaled 1.4RC3 for test purpuoses and that 2 files to overwrite from post 21 also aint solve myt problem. I've still got logged out at random circuimstances.
Link to comment
Share on other sites

After you logged in to admin, works a while, then after that you get logged out automatically?


occurrence is randomly, i mean that sometimes i can work for about 10 minutes , changing tabs etc and everything is ok, but sometimes, each click on something (tabs/ subtabs) cause log out.

Strange thing is when im logged out and i'm on the login screen, after input login / pwd and clicked login nothing happens... It's equivalent to refresh the login screen. After 3~5 tries login process starting to work properly and im redirected to admin panel.



If that is the same issue you faced, could you share more details like what is your ISP? Not all login problems has something to do with this cookie IP.



My ISP is Netia - polish provider. I've got dynamic assigned IP via ADSL


Ps. I also tried to work on my laptop which is connected to the internet via wireless gsm connection provided by ERA GSM - problem still exist :/
Link to comment
Share on other sites

  • 2 weeks later...

Having sign in problems myself to the ADMIN.

From my home connection (Fios) I can access the ADMIN just fine from Safari & Firefox. But from work (T1), I can't access the ADMIN from Safari or Fire Fox. Strangely, I can access the ADMIN at work with Opera. The admin screen always comes up fine, but it won't take my username and password in certain situations.

I am running 1.3. I will try changing the code like post #8 mentioned in this thread.
R

Link to comment
Share on other sites

I have been having the same issue, I can login to admin but get logged off all the time, which makes it impossible to use the backend. I am running Version 1.3.3.0.

Replacing this code located in /classes/cookie.php:

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())))



With:

if ($this->id_employee AND Validate::isUnsignedId($this->id_employee) AND Employee::checkPassword(intval($this->id_employee), $this->passwd))



Solved the issue for me.

Thanks to Vodien and anyone else who contributed to solving this issue.

Mike

Link to comment
Share on other sites

  • 2 weeks later...

I have de same proble please help me, the example line is

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())))



but my line is a little diferent like this

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($_SERVER['REMOTE_ADDR'])))



I'm from argentina please help my code, How should be?

   function __set($key, $value)
   {
       if (is_array($value))
           die(Tools::displayError());
       if (preg_match('/¤|\|/', $key) OR preg_match('/¤|\|/', $value))
           throw new Exception('Forbidden chars in cookie');
       $this->_content[$key] = $value;
       $this->write();
   }

   /**
     * Magic method wich delete data into _content array
     *
     * @param $key key wanted
     */
   function __unset($key)
   {
       unset($this->_content[$key]);
       $this->write();
   }

   /**
     * Check customer informations saved into cookie and return customer validity
     *
     * @return boolean customer validity
     */
   function isLogged()
   {
       /* Customer is valid only if it can be load and if cookie password is the same as database one */
        if ($this->logged == 1 AND $this->id_customer AND Validate::isUnsignedId($this->id_customer) AND Customer::checkPassword(intval($this->id_customer), $this->passwd))
           return true;
       return false;
   }

   /**
     * Check employee informations saved into cookie and return employee validity
     *
     * @return boolean employee validity
     */
   function isLoggedBack()
   {
       /* Employee is valid only if it can be load and if cookie password is the same as database one */
        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($_SERVER['REMOTE_ADDR'])))
           return true;
       return false;
   }

   /**
     * Delete cookie
     */
   function logout()
   {
       $this->_content = array();
       $this->_setcookie();
       unset($_COOKIE[$this->_name]);
   }

Link to comment
Share on other sites

  • 2 weeks later...

I'm having this login loop problem. I'm trying to use 1.4 (latest stable release), and cannot login to the admin page. It just refreshes with the login screen again (no errors given).

I'm using GoDaddy for hosting.

I've tried the files in post #21, but it didn't help. I tried commenting out the line in Cookie.php, but that didn't help (it started giving me an invalid password error).

I've reverted back to the original files now.

If anyone has any other solutions, I'd love to hear 'em, otherwise I'm switching to another cart and forgetting Prestashop altogether.

Link to comment
Share on other sites

  • 2 weeks later...

BillyCovington
I have the same problem, in my two shops, one with 1.37 and the other with 1.4

also with godaddy and argentine, I was 3 months without problems and one day stopped working.

I like prestashop, but so I can not continue.

I did everything mentioned in the forum until today April 2, 2011,

to reinstall the version 1.4 again and the same errors

I do, I change my hosting, shop?

Link to comment
Share on other sites

  • 3 weeks later...
  • 5 weeks later...

comment out this line of code around line 195: Cookie.php


AND (!isset($this->_content['remote_addr']) OR $this->_content['remote_addr'] == ip2long(Tools::getRemoteAddr()) OR !Configuration::get('PS_COOKIE_CHECKIP'))



like:

/*AND (!isset($this->_content['remote_addr']) OR $this->_content['remote_addr'] == ip2long(Tools::getRemoteAddr()) OR !Configuration::get('PS_COOKIE_CHECKIP'))*/



now everything is stable in 1.4.2.5

Link to comment
Share on other sites

  • 2 months later...

I was told all we need is to delete/comment this line away, the problem will fly again.<br/><br/>Applicable to V1.4, for V1.3, refer to page one of thread.<br/><br/>Edit File: <presta shop folder>/classes/cookie.php<br/>Code can be found on line 195<br/><br/>Before<br/>

AND (!isset($this->_content['remote_addr']) OR $this->_content['remote_addr'] == ip2long(Tools::getRemoteAddr()))

<br/><br/>After<br/>

//AND (!isset($this->_content['remote_addr']) OR $this->_content['remote_addr'] == ip2long(Tools::getRemoteAddr()))

<br/><br/>Reference to code from http://www.vodien.com/support/96/prestashop-auto-log-out-issue.html

 

Works for me in PrestaShop v1.4.4.0 :) thanks a lot!

Link to comment
Share on other sites

Hi everybody,

First of all, I want to let you know that we do keep an eye on these threads, and that I personally have added this to my most recent bug report.

 

I've posted that to a couple other threads regarding this login issue, but I apologize for not getting to yours until now.

 

I can tell you that we are actively working on this, and will be sure to come back and let you know as soon as I have an update.

 

In the meantime, thank you to everyone here who has been posting code updates and suggestions, because you are the best resource to your fellow PS members because you have seen some of these issues in your own storefronts.

 

I will be sure to keep you all posted on our progress, and if you have any additional questions, please don't hesitate to contact me directly via PM.

 

Thanks,

Mike

Link to comment
Share on other sites

Mike,

 

After 2 weeks of setting up my store, bought modules spend many many hours, I realize that i cannot log into my back office!!!

 

From the forum i see that this problem exists for months now.

 

I cannot believe my eyes when i read from you (as a manager) that you are still working on it and have not found a solution.

 

You should either fix it immediately or put a great WARNING sign to any person tyrying to download prestashop in the first place.

 

Beyond dissapointing...

Link to comment
Share on other sites

Hi everybody,

Trust me, we do take this very seriously. As a matter of fact, I have already become a thorn in the side of the development team as I push for them regularly to fix this.

 

I have succeeded in getting it escalated to a top priority, and you can keep track of our progress on it here.

 

Additionally, if you think you can contribute some information that can help us out, you can email the developer working on it directly here.

 

I hope to be able to come back soon with the good news you've all been waiting for, and if you can answer some of the questions he may have on the bug tracker, we may be able to get this taken care of even more quickly!

 

-Mike

  • Like 1
Link to comment
Share on other sites

Good morning everybody,

As promised, our developers put in some serious work over the weekend, and Maxence has now submitted his fix to the core application! You can learn more by checking out the bug report, but you should no longer have any issues with this. If you do, please just let me know.

 

-Mike

Hi Mike

where is the fix weshould use since I could not reach it through the bug report. I have version 1.3 and would like to know the exact files fixed so I replicate them.

thnx

Link to comment
Share on other sites

As there was no real description of the problem on the first post I am assuming that my problem is the same

I have installed and configured the script for a client using presta shop ver 1.4.4.1

It worked fine, I had her login and look over things from NY (I installed from Miami)

I can not get into the admin section and neither can she, no passwords were changed and neither were ANY settings.

I am getting an "employee does not exist" message

I have checked the sql and the settings.php and all reflect the correct information.

Help

Thanks

Paul

Link to comment
Share on other sites

I am getting same error even after reinstalling .

 

1. it does not proceed after the 3rd step

2. when i login at the admin then it says employee does not exist or password incorrect .

 

Hi RedHawk,

Please try the suggestions posted here: http://www.prestashop.com/forums/topic/126397-solved-installation-configuration-stalling-at-step-3/

 

-Mike

Link to comment
Share on other sites

I am getting same error even after reinstalling .

 

1. it does not proceed after the 3rd step

2. when i login at the admin then it says employee does not exist or password incorrect .

 

Hi RedHawk,

Please try the suggestions posted here: http://www.prestashop.com/forums/topic/126397-solved-installation-configuration-stalling-at-step-3/

 

-Mike

Dear Mike

 

i have already gone thru this but still can not get it done i am stuck here . if you can help me with this it will be a great help . I have been trying to get this done for over a week now

Link to comment
Share on other sites

  • 3 weeks later...
  • 6 months later...

I've run into this problem on a fresh install (PS 1.4.7.3) on a subdomain. SSL is enabled and my host (Hostgator) has confirmed the subdomain is enabled via wildcard SSL.

 

I see no files in the bug report. I created an account and clicked 'Source' per Maxine's instructions and the following message appears:

 

This list of changesets may be incomplete, as errors occurred retrieving changesets from the following repositories:[/color]

]

 

Hi Red Hawk,

Have you tried to code fixes laid out by our developer in the bug report?

 

-Mike

Link to comment
Share on other sites

  • 2 weeks later...

I've run into this problem on a fresh install (PS 1.4.7.3) on a subdomain. SSL is enabled and my host (Hostgator) has confirmed the subdomain is enabled via wildcard SSL.

 

I see no files in the bug report. I created an account and clicked 'Source' per Maxine's instructions and the following message appears:

 

I also installed now 1.4.7.3 and still got the problems:

With errors on in config I got the following message:

 

Warning: require_once(/Applications/MAMP/htdocs/prestashop-demo/admin/init.php) [function.require-once]: failed to open stream: No such file or directory in /Applications/MAMP/htdocs/prestashop-demo/admin/header.inc.php on line 36

 

Fatal error: require_once() [function.require]: Failed opening required '/Applications/MAMP/htdocs/prestashop-demo/admin/init.php' (include_path='.:/Applications/MAMP/bin/php5.3/lib/php') in /Applications/MAMP/htdocs/prestashop-demo/admin/header.inc.php on line 36

 

Just looking with a clear view. I think that the issue is that the directory cannot redirect to the tab directory to show the backend

 

Ed Boon

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...

hi! I still have problem, permanent redirection to this page:

http://vipamoda.ar/a...irect=index.php (shop is intalled on local machine, so link is not working for you)

 

this is configuration of my local server: http://gabdi.anivers.ru/phpinfo.htm — it's a standart xampp-win32-1.7.7-VC9-installer

 

i have Win 7 x64, Chrome 18.0.1025.168 (i'm try to clear all browser's cache, using private mode and also using Google Chrome Canary — no positive results...)

prestashop 1.4.7.3 (full mode)

 

and very intrested moment, it's absolutely no problems on ALL other browsers!! A have tested it on last versions of FireFox, Safari, Opera, IE. Just only with Chome I have a problems... :(

 

And proxy is off.

 

please, help!

Edited by argimko (see edit history)
Link to comment
Share on other sites

  • 9 months later...

Hi all,

 

I also have the redirect problem. It started happening after i added this code to htacess trough backoffice and now i cant login.

Can anyone help me please?

 

RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.pertempus\.com$ [NC]
RewriteRule ^(.*)$ http://pertempus.com/$1 [R=301,L]

Link to comment
Share on other sites

  • 1 month later...

I have a fix for this problem, actually 2 fixes, after spending hours a day over easter fixing this.

 

If prestashop is logging you out try these.....

 

1. Call your ISP. Sky broadband saw my IP address was bouncing around so they did some changes while i was on the phone and suddenly instantly some of my computers could now log into prestashop without being logged out. So, call your ISP first. Dont get confused with dynamic IP. Dynamic IP is fine but your IP still shouldn't be bouncing around with 50 different IP addresses.

 

2. BUT, my main computer which is connected directly to my tplink wireless router with a lan cable, still wasn't working even after the above fix. i went into my router wireless router settings by typing in the routers ip address into the browser, and noticed my security for the router was set to TKIP encryption instead of automatic, as soon as i changed it to automatic it instantly fixed the problem. completely 100% fixed. So point being here, check your router security section, play around with the encryption/security, try different settings in the security or even try removing ALL security on the wireless router for a while.

 

I had both of the above problems, at the same time, hence why ive been screwed for 5 days or so.

 

Good luck, onto the next problem. If anyone knows how to re-install footers in prestashop please let me know. our site babyoutlet.ph doesnt have a footer anymore and has lost some of the footer modules. We badly want the same footer from our other site eyewearoutlet.ph in our babyoutlet site. If anyone knows how to do this please let me know. They are in different versions of prestashop (1.4.7 & 1.5.3) thanks.

  • Like 1
Link to comment
Share on other sites

  • 3 months later...

comment out this line of code around line 195: Cookie.php

 

 

AND (!isset($this->_content['remote_addr']) OR $this->_content['remote_addr'] == ip2long(Tools::getRemoteAddr()) OR !Configuration::get('PS_COOKIE_CHECKIP'))

 

like:

 

/*AND (!isset($this->_content['remote_addr']) OR $this->_content['remote_addr'] == ip2long(Tools::getRemoteAddr()) OR !Configuration::get('PS_COOKIE_CHECKIP'))*/

 

now everything is stable in 1.4.2.5

 

that make those lines that you mentioned?

These lines are not a bug because in later versions including 1.5.4.1 also have it.

I ask because if this change would affect safety

Thank's

Edited by petete2008 (see edit history)
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...