Search This Blog

Nov 25, 2010

Can’t Login in Magento Admin Panel

I was frustrated after installing Magento in my localhost, aside from bunches of files and database needed. Here comes the Login trouble when you try to go in the admin panel.
After you login in Magento Panel with your username and password and you’re pretty much sure that you entered it correctly – but unfortunately you still looking for the same login page.:(. And all you see is the “Invalid Username or Password” every time you login.

What the reason behind this?

 Since were running are Magento site in a localhost and since localhost is not a true domain it cannot set a cookie. That’s the reason why we’re staying in the login page without any notifications.

Solution:
For Magento-1.4.0.1 Version
1.    Go  app/code/core/Mage/Core/Model/Session/Abstract/Varien.php with in you Magento directory.



2.    Open the file with a editor and look for the line 96 or locate the code similar below:
96 if (isset($cookieParams['domain'])) {
97 $cookieParams['domain'] = $cookie->getDomain();
98 }

3.    Replace the code found in line 96 with this one:

96 if (isset($cookieParams['domain']) && !in_array("127.0.0.1", self::getValidatorData())) {

The purpose of this code is to disable the Magento’s domain checking when accessing localhost and run as usual if it is being accessed from a valid domain.

You can post your solution for you version.




1 comments:

Anonymous said...

Thanks for posting this. Now I can login with my Magento Development in Localhost