Why I can not login to magento backend using googl

2019-01-06 13:52发布

I am using magento community edition 1.7.0.2.I am not able to login to back end of magento.I know this problem can be because of chrome not accepting cookies. But how to fix that please help. Thanks

9条回答
祖国的老花朵
2楼-- · 2019-01-06 14:39

what worked for me is what Haijerome, unfortunatelly I can't login into the backend to change the config. This is what I execute whenever I install a new fresh magento:

insert into core_config_data(scope, scope_id, path, value) values("default", "0", "web/cookie/cookie_httponly", "0");

then:

rm -Rf var/cache/mage--*
查看更多
我欲成王,谁敢阻挡
3楼-- · 2019-01-06 14:41

If on firefox works. Then the problem is cookies on chrome, try to clear your chrome's cookie.

查看更多
唯我独甜
4楼-- · 2019-01-06 14:43

There are two solutions for this, either one will work:

  • Change the cookie lifetime configuration.Go to backend -> Sytem -> Configuration -> Web -> Session and Cookie Management Set cookie lifetime to 86400 and save it .

see here

  • Go to app/code/core/Mage/Core/Model/Session/Abstract/Varien.php file within your magento directory.

Find the code:

session_set_cookie_params(
$this->getCookie()->getLifetime(),
$this->getCookie()->getPath(),
$this->getCookie()->getDomain(),
$this->getCookie()->isSecure(),
$this->getCookie()->getHttponly()
);

or

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

and replace with

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

or

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

After this save the file.

查看更多
【Aperson】
5楼-- · 2019-01-06 14:43

My problem was the fact that the server I was running was an Ubuntu fresh install with very little server maintenance configuration.

It had not updated it's date & time and it was 3h behind.

This made cookies received by Chrome to look as if they were already expired so Chrome discarded them.

查看更多
太酷不给撩
6楼-- · 2019-01-06 14:49

Our Chrome users were unable to add items to their cart... changing the Cookie Lifetime to the recommended 86400 fixed it.

Magento Community 1.7

Thank you!

Jeff

查看更多
我命由我不由天
7楼-- · 2019-01-06 14:50

the problem is that chrome isnt storing the login cookie, this can be seen by looking at the cookies in chrome | settings | content | advanced | all cookies and site data

there's probably a number of reasons why this can happen, cookie lifetime for sure is one of them..

personally I encountered this problem when running magento in localhost / on a virtual machine and connecting from a browser on the same machine. specifically the problem seems to be that chrome will not store cookies if the domain name is not qualified. so if your domain name is 'http://localhost/magento' or 'http://somename/magento' chrome will not store the cookie and consequently you will not be able to login

here's the fix:

to keep this simple i'm sticking to the example where magento is running on localhost. the same trick will work if magento is running on a vm and you're accessing from localhost, but you need to modify the hosts file on both guest os and client in such a case. (and remember that the guest ip can change so from time to time you need to update the hosts file on the host)

first choose your domainname. it's only in local so you dont need to register. i'm choosing 'dansmagentodev.com'. then in magento | system | web modify baseurl in both secure and unsecure to be http://dansmagentodev.com/magento/

next, in the same place, modify the session cookie management 'cookie domain' to be 'dansmagentodev.com'

next we need to configure your system to know that dansmagentodev.com is really localhost. we do this via the hosts file. on windows this file is in C:\Windows\System32\drivers\etc\hosts. your virus checker will probably try to stop you modifying it (for good reason, disable virus checker while you make the modification). then add the line 127.0.0.1 dansmagentodev.com

And now log in from chrome.

查看更多
登录 后发表回答