客户无法登录


12

我刚刚迁移了我的网站。但是我有一个问题。

我的客户无法登录他们的帐户。单击登录页面上的登录时。http://www.mywebsite.com/customer/account/login/应该登录他们的帐户,但它会重定向同一页面。

我是magento的新手。请帮助我如何解决?


Magento版本?
Fabian Blechschmidt

@FabianBlechschmidt 1.8.1先生
Nattapong Lip Kiatmongkollert 2013年

Answers:


20

您是否有一个自定义模板,它在1.7中工作吗?在1.8.1中添加了form_keys,因此请检查此行的自定义模板:

<?php echo $this->getBlockHtml('formkey'); ?>

如果丢失,则添加为

/app/design/frontend/base/default/template/persistent/customer/form/login.phtml

并在更新后检查所有其他表格:

https://gist.github.com/drobinson/7913822


尊敬的先生,我没有自定义模板。我没有触摸核心文件。然后<?php echo $ this-> getBlockHtml('formkey'); ?>不丢失。有什么建议吗?
Nattapong Lip Kiatmongkollert 2013年

1
请不要再打电话给我先生:)不,我唯一的想法是:-(
Fabian Blechschmidt

1
这就是我描述的问题;-)很棒,您已解决它!
Fabian Blechschmidt 2013年

无论如何,谢谢您的帮助。真的很高兴 :)
Nattapong Lip Kiatmongkollert

4

http://www.blueclawsearch.co.uk/blog/2013/12/12/fix-customer-cannot-login-to-magento-1-8-1/ 这是该问题的解决方案

这是上面的链接必须说的:

  • template/customer/form/login.phtmltemplate/persistent/customer/form/login.phtml

    <ul class="form-list">
  • 在登录表单中添加以下代码

    <input type="hidden" name="form_key" value="<?php echo Mage::getSingleton('core/session')->getFormKey(); ?>" />

如果您在其他模板中使用登录表单,则也可以使用将添加form_key到其他部分。


5
在Stack Exchange网站上,除了指向解决方案的链接外,什么都不合适,因为它可能会鼓励链接垃圾邮件。同样,外部链接可能会随着时间的推移而变化,从而制动了该“解决方案”。请在此处发布解决方案,并在需要时引用源链接。
shanemgrey 2014年

正如shaneveeg所警告的那样,链接现在已断开,其余的人处于这种状态
toon81 2015年

1

我已经在/app/Mage/Customer/controllers/AccountController.php中完成了此操作

我进行了更改,它开始为我工作

/**
 * Login post action
 */
public function loginPostAction()
{

    // generate form_key if missing or invalid
    if (!($formKey = $this->getRequest()->getParam('form_key', null))
            || $formKey != Mage::getSingleton('core/session')->getFormKey()) {
        $this->getRequest()->setParams(array(
            'form_key' =>Mage::getSingleton('core/session')->getFormKey()
        ));
    }
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.