Magento1.9.1 Please make sure your password match

2019-09-02 18:59发布

I am encountering this issue in CE1.9.1.

When a User registers (doesn't matter if its during checkout or from the Create an Account link) the user keeps getting the password mismatch error even though the password is re-entered correctly.

The form validation does not indicate a miss-match, but once a user clicks on Register it returns the mismatch error.

There is no errors in the chrome console...

I found this: https://magento.stackexchange.com/questions/37381/please-make-sure-your-passwords-match-password-error-in-checkout-with-new-re

But I don't believe it is the same error.

I need to fix it soon, any help is greatly appreciated!

9条回答
啃猪蹄的小仙女
2楼-- · 2019-09-02 19:40

as workaround you can use folloing code:

$confirmation = $this->getConfirmation();
$passwordconfirmation = $this->getPasswordConfirmation();
//if ($password != $confirmation) {
if (!(($password == $confirmation) ||
    ($password == $passwordconfirmation))) {
    $errors[] = Mage::helper('customer')->__('Please make sure your passwords match.');
}
查看更多
混吃等死
3楼-- · 2019-09-02 19:40

Change this code

app\code\core\Mage\Customer\Model\Customer.php
$confirmation = $this->getPasswordConfirmation();

to this code

$confirmation = $this->getConfirmation();
查看更多
▲ chillily
4楼-- · 2019-09-02 19:47

Changing app/code/core/Mage/Customer/Model/Customer.php as proposed by @Pedro breaks the functionality of "forgot password" and "edit customer account" pages. Instead, make the following changes to

app/code/core/Mage/Checkout/Model/Type/Onepage.php

by editing lines starting from 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);
}

and set the PasswordConfirmation -Property and not the Confirmation-Property of the Customer-Object:

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);
}
查看更多
登录 后发表回答