Magento Cookies更改阻止前端登录 [英] Magento Cookies Changing Prevent Frontend Login

查看:52
本文介绍了Magento Cookies更改阻止前端登录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当客户尝试登录Magento的前端时,他们将被重定向回登录页面,而不会出现错误.问题似乎是先写入新的cookie,然后在登录时立即覆盖.这是登录时设置的Cookies的日志:

When a customer tries to log in to the frontend of Magento they are redirected back to the login page without an error. The problem appears to be that the new cookie is written, then immediately overwritten when logging in. Here is a log of the Cookies set when logging in:

Cookie frontend added.  0o94icitv247nhh6l7op2csoe4  .domain.com 
Cookie frontend deleted.  0o94icitv247nhh6l7op2csoe4    .domain.com
Cookie frontend added.  no81giicmgscpkr14ho3m1rpv2  .domain.com
Cookie frontend changed.  0o94icitv247nhh6l7op2csoe4    .domain.com
Cookie frontend changed.  0o94icitv247nhh6l7op2csoe4    .domain.com

如果我将前端cookie手动编辑为第三行的值,那么我就登录了.关于为什么在第4行和第5行更改它的原因(偶数两次)?

If I manually edit the frontend cookie to the value on the third line, then I am logged in. Any idea on why it is being change (twice even) on lines 4 and 5?

我认为这可能是覆盖Mage_Core_Model_Session_Abstract_Varien类的扩展,但是app/code目录的grep没有显示任何扩展该类的类.

I thought it might be an extension overwriting the Mage_Core_Model_Session_Abstract_Varien class, but a grep of the app/code directory doesn't show any classes extending that class.

-更新-

我仍然有这个问题.我用XDEBUG/webgrind挖了一点,发现Mage_Core_Model_Session_Abstract_Varien->start被两次调用:

I'm still having this problem. I've dug a little more (with XDEBUG/webgrind) and found that Mage_Core_Model_Session_Abstract_Varien->start is being called twice by:

Mage_Core_Model_Session_Abstract_Varien->init @ 162
Mage_Core_Controller_Varien_Action->preDispatch @ 490

preDispatch()可能正在覆盖会话cookie.这有意义吗?我在Magento会话处理方面经验不足,因此希望有人可以在这里提供帮助.

It looks like preDispatch() might be overwriting the session cookie. Does this make sense? I don't have much experience with Magento session handling, so I'm hoping somebody can help here.

推荐答案

我终于找到了双cookie的来源.

I finally found the source of the double cookie.

TinyBrick Lightspeed页面缓存在子域级别添加了一个cookie,这使TLD上的cookie混乱了:

TinyBrick Lightspeed Page Cache was adding a cookie at the sub-domain level that was confusing the cookie at the TLD:

        public static function buildCookie()
        {
                require_once 'app/Mage.php';
                $request = new Zend_Controller_Request_Http();
                session_set_cookie_params(
                         self::getCookieLifetime()
                        ,self::getDefaultCookiePath()
//                      ,$request->getHttpHost() // commented out to fix double cookie problem.
                        ,'.domain.com' // added to fix double cookie problem.
                        ,false
                        ,true
                );
                session_name('frontend');
                session_start();
        }

这篇关于Magento Cookies更改阻止前端登录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆