我在 CE1.9.1 中遇到了这个问题。
当用户注册时(无论是在结帐期间还是通过创建帐户链接),即使重新输入正确密码,用户也会不断收到密码不匹配错误。
表单验证并不表示不匹配,但是一旦用户单击注册,它就会返回不匹配错误。
chrome控制台中没有错误...
但我不相信这是同样的错误。
我需要尽快修复它,非常感谢任何帮助!
我在 CE1.9.1 中遇到了这个问题。
当用户注册时(无论是在结帐期间还是通过创建帐户链接),即使重新输入正确密码,用户也会不断收到密码不匹配错误。
表单验证并不表示不匹配,但是一旦用户单击注册,它就会返回不匹配错误。
chrome控制台中没有错误...
但我不相信这是同样的错误。
我需要尽快修复它,非常感谢任何帮助!
我们的 1 个网店也遇到了这个问题。但是,我们使用了结帐扩展程序。所以我不确定这是否适用于常规标准结帐。反正。
问题应该是,您是否使用结帐扩展程序?
如果是这样,则该扩展名的模型文件中的值设置为:
$customer->setConfirmation($password);
但应该是:
$customer->setPasswordConfirmation($password);
对我来说,这很有效,没有改变核心中的任何东西。只是扩展应该得到一个小的更新,或者你可以像我一样手动完成。只需在扩展的模型映射文件中找到该行。
作为解决方法,您可以使用以下代码:
$confirmation = $this->getConfirmation();
$passwordconfirmation = $this->getPasswordConfirmation();
//if ($password != $confirmation) {
if (!(($password == $confirmation) ||
($password == $passwordconfirmation))) {
$errors[] = Mage::helper('customer')->__('Please make sure your passwords match.');
}
按照@Pedro 的建议更改 app/code/core/Mage/Customer/Model/Customer.php 会破坏“忘记密码”和“编辑客户帐户”页面的功能。相反,进行以下更改
app/code/core/Mage/Checkout/Model/Type/Onepage.php
通过编辑从 369 开始的行
if ($quote->getCheckoutMethod() == self::METHOD_REGISTER) {
// set customer password
$customer->setPassword($customerRequest->getParam('customer_password'));
$customer->setConfirmation($customerRequest->getParam('confirm_password'));
} else {
// emulate customer password for quest
$password = $customer->generatePassword();
$customer->setPassword($password);
$customer->setConfirmation($password);
}
并设置 PasswordConfirmation -Property 而不是 Customer-Object 的 Confirmation-Property:
if ($quote->getCheckoutMethod() == self::METHOD_REGISTER) {
// set customer password
$customer->setPassword($customerRequest->getParam('customer_password'));
$customer->setPasswordConfirmation($customerRequest->getParam('confirm_password'));
} else {
// emulate customer password for quest
$password = $customer->generatePassword();
$customer->setPassword($password);
$customer->setPasswordConfirmation($password);
}
遇到了同样的问题并解决了。斯内尔的答案更接近正确答案。问题可能出在外部/本地模块中,因此您不应该检查
app/code/core/Mage/Checkout/Model/Type/Onepage.php
当然在任何情况下都不要修改它!但是您应该找到在您的案例中使用的 _validateCustomerData() 方法。使用 Mage::log() 或 debug_backtrace() 。它可能看起来像(但不完全是,因为这部分可能由于某种原因被修改):
if ($quote->getCheckoutMethod() == self::METHOD_REGISTER) {
// set customer password
$customer->setPassword($customerRequest->getParam('customer_password'));
$customer->setConfirmation($customerRequest->getParam('confirm_password'));
} else {
// emulate customer password for quest
$password = $customer->generatePassword();
$customer->setPassword($password);
$customer->setConfirmation($password);
}
这些模块扩展了核心文件的旧版本,因此如果您的模块没有更新,您应该自己更改它们并更改
setConfirmation()
对其当前可用的模拟:
setPasswordConfirmation()
我也有同样的问题。我对代码不满意,所以我想避免上述所有摆弄。为了解决这个问题,我所做的只是更新我的扩展程序,并且我还禁用了一页结帐,清除缓存,然后重新启用一页结帐。
这现在已经解决了问题,无需修改代码。
希望它对你有帮助。
除非这确实是一个核心错误,否则我不建议更改核心文件。但我喜欢这样打开 app\code\core\Mage\Customer\Model\Customer.php 并编辑您的代码,如下所示
$confirmation = $this->getConfirmation();
$passwordconfirmation = $this->getPasswordConfirmation();
//if ($password != $confirmation) {
if (!(($password == $confirmation) ||
($password == $passwordconfirmation))) {
$errors[] = Mage::helper('customer')->__('Please make sure your passwords match.');
}
如果有人仍然无法弄清楚,为什么会这样:Conlabz Useroptin 扩展 ( http://www.magentocommerce.com/magento-connect/newsletter-double-opt-in-for-customers.html ) 可能会导致这种情况行为也一样。
更改此代码
app\code\core\Mage\Customer\Model\Customer.php
$confirmation = $this->getPasswordConfirmation();
到这个代码
$confirmation = $this->getConfirmation();