CE1.9.1请确保用户注册期间密码匹配问题


23

我在CE1.9.1中遇到此问题。

当用户注册时(无论是在结帐期间还是从“创建帐户”链接中都无关紧要),即使密码重新正确输入,用户仍然会收到密码不匹配错误。

表单验证并不表示不匹配,但是一旦用户单击“注册”,它将返回不匹配错误。

chrome控制台没有错误...

我发现了这一点:“请确保您的密码匹配”-使用“新注册”结帐时出现密码错误

但是我不相信这是同样的错误。

我需要尽快修复,非常感谢您的帮助!


这样可以解决结帐购物车中的错误,但是要使“我的帐户”部分正常工作,我必须在(admin | system | tools | compilation)中禁用编译器。(重新编译可能会以及工作)
wiredoug

Answers:


24

班级的孩子Mage_Customer_Model_Customer应该使用getPasswordConfirmation()而不是getConfirmation()

更新:在课堂上Mage_Customer_Model_Customer,方法validate()已更改

在v1.9.1之前:

$confirmation = $this->getConfirmation();

后:

$confirmation = $this->getPasswordConfirmation();



还请注意,您还应该检查所有控制器替代,而不只是检查扩展此类的模型!
benz001

2
头脑陷入僵局,以至于阻止某个电子商务商店允许购买的如此重要的事情如何通过质量检查进入正式发布。
mikemike 2015年

1
同样在某些扩展中,需要将setConfirmation()更改为setPasswordConfirmation()。就我而言,这就是FireCheckout。类:TM_FireCheckout_Model_Type_Standard,方法:_validateCustomerData()。
gSorry 2015年

5

最后,我能够解决问题。

我不得不提到,magento核心文件在保护密码时确实存在这种问题,这是不好的,猜测核心开发人员忘记了一些简单的事情。

好的,因此要解决此问题,您必须在local like中覆盖核心客户模型app/code/local/Mage/Customer/Model/Customer.php。在那走到线号。843(如果尚未覆盖)或转到行if (strlen($password) && !Zend_Validate::is($password, 'StringLength', array(6))) { $errors[] = Mage::helper('customer')->__('The minimum password length is %s', 6); }并在该块下方添加以下代码:

//To match passwords in both Create account and Checkout register pages start
    if ( Mage::app()->getRequest()->getServer('HTTP_REFERER') == Mage::getUrl('customer/account/create') )
      $confirmation = $this->getPasswordConfirmation();
    else
      $confirmation = $this->getConfirmation();
    //To match passwords in both Create account and Checkout register pages end

此后,密码和确认密码将在“结帐”和“创建帐户”页面上匹配。

希望这可以帮助某人。



3

我有一个扩展覆盖了AccountController.php,并且在低于1.9.1的Magento平台上也有同样的问题

我的解决方案是;

if (version_compare(Mage::getVersion(), '1.9.1', '<=')) {        
$customer->setPasswordConfirmation($request->getPost('confirmation'));
}

if (version_compare(Mage::getVersion(), '1.9.0', '>=')) {
$customer->setConfirmation($request->getPost('confirmation'));
}

2

对我来说,既$this->getPasswordConfirmation()没有$this->getConfirmation()工作,也没有工作。两者都返回一个空字符串。因此,我最终直接在中访问POST参数/app/code/core/Mage/Customer/Model/Customer.php(是,最好在中使用一个副本/app/code/local):

if (isset($_REQUEST['confirmation']))
    $confirmation = $_REQUEST['confirmation'];
else
    $confirmation = $this->getPasswordConfirmation();

1
哈哈好裂缝:)
Keyur Shah

0

这是因为1.9.1更新中的这一更改。您必须更新扩展程序代码-注册期间,客户密码不再以明文形式存储。


我知道了,我将检查扩展代码。谢谢!
比尔

0

我在使用第三方扩展程序进行结帐时遇到了同样的问题,因此必须解决此问题

我通过执行以下步骤解决了该错误

1)在我的模块中搜索 confirmation

2)检查是否正在设置customer模型数据

3)然后改变键password_confirmationconfirmation

我按照上述步骤调试问题并解决了。


0

我的解决方案是

$confirmation = $this->getPasswordConfirmation(); // test works for Create, fails for Checkout
    if ($password != $confirmation) {
        $confirmation = $this->getConfirmation(); // test works for Checkout fails for Create
        if ($password != $confirmation) {
            $errors[] = Mage::helper('customer')->__('Please make sure your passwords match.');
        }
    }

-3

嗨,朋友,可以通过以下步骤解决此问题:

步骤1:打开该文件/app/code/core/Mage/Customer/Model/Customer.php
步骤2:在Customer.php $confirmation = $this->getPasswordConfirmation(); 步骤3中找到此行: $confirmation = $this->getConfirmation();

您的问题现在已解决。


3
除非这确实是一个核心错误,否则我不建议更改核心文件。
安德鲁·凯特
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.