Quantcast
Viewing latest article 8
Browse Latest Browse All 25

Cannot login to Magento admin after new installation (solved)

Image may be NSFW.
Clik here to view.
Magento CMS website logo
I moved my magento 1.8.1 installation to a new VPS server and encountered the issue that I couldn’t login to the cms. After filling in my username and password it would redirect me to the login page.

I tested the following:

1) Comment code from line 87 to 108 in app/code/core/Mage/Core/Model/Session/Abstract/Varien.php

// session cookie params

$cookieParams = array(
'lifetime' => $cookie->getLifetime(),
'path' => $cookie->getPath(),
'domain' => $cookie->getConfigDomain(),
'secure' => $cookie->isSecure(),
'httponly' => $cookie->getHttponly()
);
if (!$cookieParams['httponly']) {
unset($cookieParams['httponly']);
if (!$cookieParams['secure']) {
unset($cookieParams['secure']);
if (!$cookieParams['domain']) {
unset($cookieParams['domain']);
}
}
}
if (isset($cookieParams['domain'])) {
$cookieParams['domain'] = $cookie->getDomain();
}

This is a temporary fix. After implementing this code AND clearing my cache via SSH (with rm -rf /var/cache/*) I could login to the CMS admin backend. But the next day it didn’t work anymore and I had to clear the cache to be able to login again.

*** This fix is not recommended on a production environment due to security vulnerability ***

2) Check the cookie configs in core_config_data table 

web/cookie/cookie_path -> "/"
web/cookie/cookie_domain -> "domain.com"

In my case there my domain name was “.domain.com” which I changed to “domain.com”. But this didn’t resolve the admin no-login issue.

3) Check if your session is being saved on db in app/etc/local.xml

<session_save>db</session_save>

In my case this wasn’t the case, so I added this setting. But this didn’t resolve the admin no-login issue.

4) Check your SSL implementation

When testing my soap connection and trying to open the soap url http://domain.com/api/v2_soap?wsdl=1 I encountered an SSL certificate message that this was an untrusted connection.

This got me thinking. My SSL certificate was not implemented correctly. Before correcting the SSL I tested wether the secure URL (https://) for Magento caused the admin no-login issue.

PHPMyAdmin

SELECT * FROM `core_config_data` WHERE `path` LIKE '%base_url%';
change "web/secure/base_url" from https:// to http://

After this I could login to the CMS admin normally. Several people mentioned having this issue on their development / testing environment, this could probably fix it?

Solution 1) is also connected to secure domain name…


Viewing latest article 8
Browse Latest Browse All 25

Trending Articles