我在CE1.9.1中遇到此问题。
当用户注册时(无论是在结帐期间还是从“创建帐户”链接中都无关紧要),即使密码重新正确输入,用户仍然会收到密码不匹配错误。
表单验证并不表示不匹配,但是一旦用户单击“注册”,它将返回不匹配错误。
chrome控制台没有错误...
我发现了这一点:“请确保您的密码匹配”-使用“新注册”结帐时出现密码错误
但是我不相信这是同样的错误。
我需要尽快修复,非常感谢您的帮助!
我在CE1.9.1中遇到此问题。
当用户注册时(无论是在结帐期间还是从“创建帐户”链接中都无关紧要),即使密码重新正确输入,用户仍然会收到密码不匹配错误。
表单验证并不表示不匹配,但是一旦用户单击“注册”,它将返回不匹配错误。
chrome控制台没有错误...
我发现了这一点:“请确保您的密码匹配”-使用“新注册”结帐时出现密码错误
但是我不相信这是同样的错误。
我需要尽快修复,非常感谢您的帮助!
Answers:
班级的孩子Mage_Customer_Model_Customer
应该使用getPasswordConfirmation()
而不是getConfirmation()
更新:在课堂上Mage_Customer_Model_Customer
,方法validate()
已更改
在v1.9.1之前:
$confirmation = $this->getConfirmation();
后:
$confirmation = $this->getPasswordConfirmation();
最后,我能够解决问题。
我不得不提到,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
此后,密码和确认密码将在“结帐”和“创建帐户”页面上匹配。
希望这可以帮助某人。
如果仍然不知道,为什么会这样:Conlabz Useroptin扩展(http://www.magentocommerce.com/magento-connect/newsletter-double-opt-in-for-customers.html)可能导致此问题行为也是如此。
所述扩展的更新1.1.0增加了1.9兼容性
我有一个扩展覆盖了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'));
}
对我来说,既$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)在我的模块中搜索
confirmation
2)检查是否正在设置
customer
模型数据3)然后改变键
password_confirmation
从confirmation
我按照上述步骤调试问题并解决了。
我的解决方案是
$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.');
}
}