Magento - Can't login to admin in localhost

I am currently working on magento version 1.3.2.4. When i login to admin, it looks like i have entered proper username and password because it doesn't show any error like "Invalid username or password". When i try with fake login I do get error. Even i am not getting any error it stays on the login page.
So, I had to go through code and comment out few lines after which I was able to login and access admin again.
app\code\core\Mage\Core\Model\Session\Abstract\Varien.php line 77: original:
// set session cookie params
session_set_cookie_params(
    $this->getCookie()->getLifetime(),
    $this->getCookie()->getPath(),
    $this->getCookie()->getDomain(),
    $this->getCookie()->isSecure(),
    $this->getCookie()->getHttponly()
);

Commented out three lines:
// set session cookie params
session_set_cookie_params(
    $this->getCookie()->getLifetime(),
    $this->getCookie()->getPath() /*,
    $this->getCookie()->getDomain(),
    $this->getCookie()->isSecure(),
    $this->getCookie()->getHttponly()*/
);



As, I am upgrading magento from old community to enterprise 1.11 version. When i needed to login to admin of enterprise version, i got same issues. But this time code was different, so this is what i needed to do to access magento enterprise admin again.
app\code\core\Mage\Core\Model\Session\Abstract\Varien.php change:
if (isset($cookieParams['domain'])) {
    $cookieParams['domain'] = $cookie->getDomain();
}
To
if (isset($cookieParams['domain']) && !in_array("127.0.0.1", self::getValidatorData())) {
    $cookieParams['domain'] = $cookie->getDomain();
}
Reference :- http://dltr.org/blog/magento/178/Magento-Cant-login-to-admin-in-localhost


No comments:

Post a Comment