2

I have been facing issue with Magento registration, when ever when I try to checkout with new registration, I get an password mismatch error "Please make sure your passwords match." whereas the password entered is correct, but still I get the mismatch error, because of this, the user is unable to register itself and checkout the order,

enter image description here

The error I am getting in browser console is , enter image description here

Update: By default, when I click "Register" option in checkout step, the registration form shows saved username and password of some other page in "Fax" and "Passwords" fields. So I deleted it and typed new password. Then I tried to print the values of "pass.value" and "conf.value" before the line "return (pass.value == conf.value);" in the file /js/prototype/validation.js. . But When I print the values I got "my saved password" in pass.value variable and "empty value" in conf.value variable.

How can I fix this problem ? Any help appreciated.

2
  • is there any error in console ? Sep 29, 2014 at 9:29
  • @programmer_rkt: I have updated the question with "error message in console". Sep 29, 2014 at 9:41

5 Answers 5

5

are you absolutely sure the passwords match? turn the fields into text fields to test it.
Also take a look at how the retype password validation works.
In the file /js/prototype/validation.js there is this for password validation:

 ['validate-cpassword', 'Please make sure your passwords match.', function(v) {
            var conf = $('confirmation') ? $('confirmation') : $$('.validate-cpassword')[0];
            var pass = false;
            if ($('password')) {
                pass = $('password');
            }
            var passwordElements = $$('.validate-password');
            for (var i = 0; i < passwordElements.size(); i++) {
                var passwordElement = passwordElements[i];
                if (passwordElement.up('form').id == conf.up('form').id) {
                    pass = passwordElement;
                }
            }
            if ($$('.validate-admin-password').size()) {
                pass = $$('.validate-admin-password')[0];
            }
            return (pass.value == conf.value);
        }],

This is a good place to debug.
Maybe your markup is wrong and this fails.
try to log something before the returns statement return (pass.value == conf.value);.
See what the pass and conf fields are. Maybe you have an other password field in the page and the value for your password confirmation is matched against that one.

[EDIT]

I think I found the problem. Like I suspected there is an element with the id confirmation in your page. Everything happens because the login/register popup you have in every page. The one you get when you click the "Login/register" link in the top left corner.
There is a password confirmation field in that form with the id confirmation.
That's what it gets validated when you submit your form.
To fix this, I would take the easy way out.
I would remove the popup in the checkout page.
There are also other methods but this is the easiest. You don't need anyway the login and registration form in the checkout page because your can already do that in the checkout process.

6
  • Yes, I tested with text field. Password is correct. ok I ll try these instructions :) Sep 29, 2014 at 9:44
  • Hi, I have tested the registration form in validation.js and updated the question with the actual values I get in password field. But still I am not able to fix the issue. Please check my updated question. Thank You. Sep 29, 2014 at 10:14
  • @BalajiKandasamy. Notice that the validation method starts with this line: var conf = $('confirmation') ? $('confirmation') : $$('.validate-cpassword')[0];. Is there an element with the id confirmation in your page?
    – Marius
    Sep 29, 2014 at 10:34
  • @BalajiKandasamy. Is your website public? I think I could help you better if I had a link to the website.
    – Marius
    Sep 29, 2014 at 10:34
  • 1
    @BalajiKandasamy. See the update to my answer.
    – Marius
    Sep 29, 2014 at 12:07
3

Problem

Well this is a common problem that is encountered in Magento 1.9.1.0. 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.

Reason

The validation method was changed in v1.9.1.

Earlier: $confirmation = $this->getConfirmation();

Now: $confirmation = $this->getPasswordConfirmation();

So the children of class Mage_Customer_Model_Customer should use getPasswordConfirmation() instead of getConfirmation()

Solution

Go to file app/code/core/Mage/Customer/Model/Customer.php

Find the below code : $confirmation = $this->getPasswordConfirmation(); Change this to : $confirmation = $this->getConfirmation();

If this still doesn’t work then add it to a condition mentioned below

if(Mage::app()->getFrontController()->getRequest()->getModuleName() == ‘onepagecheckout’) {
    $confirmation = $this->getConfirmation();
} else {
    $confirmation = $this->getPasswordConfirmation();
}
2

Here is what that worked for me. It covers both the stand-alone registration page (/customer/account/create/) and the checkout registration page (/checkout/onepage/?register).

Look for the same $confirmation = $this->getConfirmation(); line and change it to:

    $confirmation = $this->getConfirmation() ? $this->getConfirmation() : $this->getPasswordConfirmation();

    if ($password != $confirmation) {
        $errors[] = Mage::helper('customer')->__('Please make sure your passwords match.');
    }
0

Copy file /app/code/core/Mage/Customer/Model/Customer.php to app/code/local/Mage/Customer/Model/Customer.php and edit with your favorite PHP editor. Around line number 845 replace

$confirmation = $this->getPasswordConfirmation();

with

$confirmation = $this->getConfirmation() ? $this->getConfirmation() : $this->getPasswordConfirmation();

Save and try again to registration during checkout proceed

Bit it would be a lot better to make a rewrite instead of editing core files, even in app/code/local.

2
  • 1
    you should never edit core files.
    – Marius
    Jul 14, 2015 at 8:22
  • 1
    thanks all. it works for me. i've tested on magento 1.9.1.0 with extend it to local/Mage Aug 24, 2015 at 5:54
-3

Unless this truly is a core bug, I wouldn't recommend changing core files.But i sloved this way Open app\code\core\Mage\Customer\Model\Customer.php and edit your code like below

$confirmation = $this->getConfirmation();
    $passwordconfirmation = $this->getPasswordConfirmation();
    //if ($password != $confirmation) {
    if (!(($password == $confirmation) || 
          ($password == $passwordconfirmation))) {
        $errors[] = Mage::helper('customer')->__('Please make sure your passwords match.');
    }
2
  • So, apart from the core bug (which you do not recommend yourself): Why are you trying to compare the password with the confirmation (code)? Mar 26, 2015 at 11:40
  • i know you are right but i just share my solution if you have any other solution then just share so that i learn something
    – Haseeb
    Mar 27, 2015 at 7:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.