Quantcast
Channel: Magento Development – Coding Basics
Viewing all articles
Browse latest Browse all 21

Fix: Magento Admin Login Problem

$
0
0

Last week we had a very strange problem with the admin login of a Magento client of ours. When we tried to login we would get a session id in the url and everything seemed to work, but we were redirected to the same login box. Normally when you enter incorrect admin login details you will get a error message, but this was not the case this time. It turns out that this is actually a very common problem in Magento that has to do with cookies.

Solution for Magento 1.0 – 1.4.

To fix the Magento admin login problem you’ll have to open app/code/core/Mage/Core/Model/Session/Abstract/Varien.php. Search for the following code snippet which should be located between line 80 and 83. Comment it out like we have done in the code snippet below and you should be good to go. You can comment it back in once you are logged in to the admin panel.

// set session cookie params
session_set_cookie_params(
$this->getCookie()->getLifetime(),
$this->getCookie()->getPath()//,
//$this->getCookie()->getDomain(),
//$this->getCookie()->isSecure(),
//$this->getCookie()->getHttponly()
);

Please remember that you should never permanently edit core files. If you insist on doing this move them over to the local map instead of keeping them in the core. This will prevent your changes from being lost when you upgrade to a newer Magento version.

Solution for Magento 1.4 – 1.9.

For newer versions of Magento you can fix the problem by looking for and commenting out the following code snippet in app/code/core/Mage/Core/Model/Session/Abstract/Varien.php. It should be located between line 80 and 100.

/*  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();
} */

Hope this will fix the admin login problem for you. If it does not we suggest you clear your browser cache and cookies and try again. It should work now.

The post Fix: Magento Admin Login Problem appeared first on Coding Basics.


Viewing all articles
Browse latest Browse all 21

Trending Articles