Saturday 31 October 2015

Please make sure your passwords match in magento – Magento

From Magento 1.9.1.0 version the users are getting errors at the checkout or from the 'Create an Account link'. When user register,user keep getting the password mistmatch error even though the password is correctly entered.

Form the Magento 1.9.1.0 the validate fuction in the Mage_Customer_Model_Customer class has changed following line.

before 1.9.1.0

$confirmation = $this->getPasswordConfirmation();


After (or from) 1.9.1.0

$confirmation = $this->getConfirmation();


So i was having the login popup extension where in the create function it sets the confirmpassword as follows

$customer->setConfirmation($this->getRequest()->getPost('confirmation'));


and before magento 1.9.1.0 the validate function was taking this setConfirmation value in the validate function as $this->getConfirmation(); but due to change in the validate function to $this->getPasswordConfirmation(); some users are getting the error as “Please make sure your passwords match”.

Due to the method change in core code on Magento 1.9.1.0, if any of the 3rd party extension like 'onepagecheckout' or 'quicklogin' which was using this method, will not work as expected.

To ensure that extensions work as expected with Magento 1.9.1.0, we need to check the version in code & accordingly call the required method –

So i had changed following code in my extension file as follows

$info = Mage::getVersionInfo();
$version = "{$info['major']}.{$info['minor']}.{$info['revision']}.{$info['patch']}";

if($version >= '1.9.1.0'){
$customer->setPasswordConfirmation($this->getRequest()->getPost('confirmation')); // just check the name of confirm password field in the registration form accordlingly add the name in the get Post
} else {
$customer->setConfirmation($this->getRequest()->getPost('confirmation')); // just check the name of confirm password field in the registration form accordlingly add the name in the get Post
}

No comments:

Post a Comment