Magento: 无法登录后台 Can’t login to admin panel

This tutorial shows how to resolve the Magento admin panel login issue.

It’s a common issue: you are trying to login to the Magento admin panel, typed your username and password, clicked Login button and nothing happens. The page refreshes and that’s all. No error or any other messages.

This is caused by the cookies issue. In some cases Magento can’t store them. Let’s see how the issue can be resolved.

Using localhost (WAMP, XAMP, AppServ etc)

If you are running Magento on local server using the specific server applications (listed above) try to replace localhost in the website URL with ‘127.0.0.1’. In other words link to the Magento admin panel login page will be ‘127.0.0.1/magento/admin’

If this doesn’t help please proceed to other solutions

Edit Varien.php file

Open Magento installation directory and go to the ‘app\code\core\Mage\Core\Model\Session\Abstract’ folder. There open ‘Varien.php’ file with your editor (Adobe Dreamweaver, Notepad ++ etc).

Depending on your version of Magento the code can be different so I’ll show you several cases.

Magento 1.4.x

In the Varien.php file locate the code:

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

And comment it. Type /* before the code and */ after. Or just replace it with the code below:

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

Magento 1.5.x and Magento 1.6.x

In the Varien.php file locate the code:

$cookieParams = array(            
    'lifetime' => $cookie->getLifetime(),            
    'path'     => $cookie->getPath(),            
    'domain'   => $cookie->getConfigDomain(),            
    'secure'   => $cookie->isSecure(),            
    'httponly' => $cookie->getHttponly()        
);

and replace with

$cookieParams = array(            
    'lifetime' => $cookie->getLifetime(),            
    'path'     => $cookie->getPath(),            
    //'domain'   => $cookie->getConfigDomain(),            
    //'secure'   => $cookie->isSecure(),            
    //'httponly' => $cookie->getHttponly()        
);

Then comment the code:

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

the same way as for the Magento 1.4.x (please check above)

Magento. Can’t login to admin panel, 5.0 out of 51 based on 2 ratings

转自:http://www.templatemonster.com/help/magento-cant-login-to-admin-panel.html

 

更多参考:

Magento 1.9.X 系列教程

Magento: 后台显示图片不能找到 Image file was not found on product tab

Magento: 解决搜索失效的问题 Search Not working

 

本文: Magento: 无法登录后台 Can’t login to admin panel

 

Loading

Add a Comment

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.