Can't login to Magento admin

2020-01-27 05:44发布

I have magento installed in a subdirectory. www.domain.com/subdir/magento

This site worked perfectly at one point. I changed nothing, until my client said he couldn't login to magento admin.

I logged in just fine from my computer, but on his computer it just redirected back to the magento admin login without an error message and a url that looked goofy like this:

http://domain.com/subdir/magento/index.php/admin/index/index/key/3097210b826ac4a86d7531cb4089c9d0/

I thought that his cookies were being blocked, but that was not the case.

My magento settings were secure/unsecure baseurl: http://domain.com/subdir/magento/

web cookie path: (blank)
web cookie domain: (blank)

After clearing out var/cache, I found that I myself could not login to the admin either, with the same exact issue.

I tried the following settings without luck:

path: /
domain: domain.com

path: /subdir/magento
domain: vigrond.com

I also tried commenting out those lines in Varien.php, but that had no effect either.

My server account is a VPS and it has plenty of free space.

So I'm pretty much lost, wondering why this happened in the first place when it worked before (didn't change anything), and why it's so complicated?

Any help appreciated

标签: magento admin
12条回答
疯言疯语
2楼-- · 2020-01-27 06:17

Delete cookies (related to your domain) from your browser setting.

查看更多
女痞
3楼-- · 2020-01-27 06:17

If nothing works, make sure the disk quota is not exceeded. The new session cookies created under ./var/session will be zero bytes length if disk quota for the user is exceeded.

查看更多
Deceive 欺骗
4楼-- · 2020-01-27 06:25

Find app/code/core/Mage/Core/Model/Session/Abstract/Varien.php. in your Magento install folder. Comment out the lines (see below) 80 to 83. The line number may vary.

    // set session cookie params
    session_set_cookie_params(
        $this->getCookie()->getLifetime(),
        $this->getCookie()->getPath()//,
        //dependes which versin of mage you are using, you may comment these as well
        //$this->getCookie()->getDomain(),
        //$this->getCookie()->isSecure(),
        //$this->getCookie()->getHttponly()
    );

This is caching issue. Which recently Magento community confirmed that is sorted but it is not. :)

Just clear your cache and do this steps it should work anyway.

Comment this lines also

//        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();
//        }
  • Make sure you have cookies enabled in your browser, try a number of different browsers including Safari or Opera. Chrome will give some problems and you need to remember to clear you cache in Chrome after making changes!

  • Make sure you file permissions are set to EVERYONE - FULL CONTROL for Windows and 777 for your Mac/Linux environment If all that still doesn’t work you can try this: (I do not recommend this solution for a production version of Magento, but for you local test enviroment this will work.)

  • Check the version of php you are using. If you are using recent Magento try to find which version of PHP and extensions requires.

More details

查看更多
该账号已被封号
5楼-- · 2020-01-27 06:25

Check the cookie configs in core_config_data table and check if your session is being saved on db. In my case, someone just changed the cookie domain and the cookie path with a wrong value.

You can also check this on the node in your app/etc/local.xml. If it's on db, maybe you should change do files to be able to clean the session data directly on var/session dir.

查看更多
祖国的老花朵
6楼-- · 2020-01-27 06:26

Also, you can update the password in the database if everything else from above didn't work and you need desperate access:

UPDATE admin_user SET password=CONCAT(MD5('qXpassword'), ':qX') WHERE username=‘user’;

replace user and password words according to your needs.

查看更多
相关推荐>>
7楼-- · 2020-01-27 06:27

I never resolved the issue. But I wiped the clients computer and reinstalled windows 7, and it worked. It was very strange that it didnt work before as he was not behind a proxy, did not have ad ons or viruses. And the issue reproduced in each of his browsers (chrome firefox and IE). It was not a router issue. It was a windows issue, but I couldn't tell you what exactly was causing it. It was not the internet security settings either, as I checked those. Also checked the host file. As I said before, very baffling

查看更多
登录 后发表回答