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: 无法登录后台 Can't login to admin panel

 

 

 

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值