Learn to Encrypt Customer Password in Magento
Unfortunately, since we have to integrate our another customized system x in magento, we have to find a way to sync it's users and passw...
https://www.czetsuyatech.com/2021/07/magento-encrypt-customer-password.html
Unfortunately, since we have to integrate our another customized system x in magento, we have to find a way to sync it's users and passwords fields.
Which we have achieved by:
Assumption:
1.) You must have a deployed magento system which you can access (because magento's libraries will be use in this solution). Specifically, core/encryption and core/helper/data.
To call the magento api in another system, paste the following lines:
And add more lines:
BTW, for info, you can check if you have entered a correct password by adding this line:
If it echoes 1 then the password is correct. Try it, it works for me.
Which we have achieved by:
Assumption:
1.) You must have a deployed magento system which you can access (because magento's libraries will be use in this solution). Specifically, core/encryption and core/helper/data.
To call the magento api in another system, paste the following lines:
require_once 'app/Mage.php'; //change the directory accordingly :D
umask(0);
$app = Mage::app('default');
And add more lines:
$obj = Mage::getModel('core/encryption'); //instantiate the core encryption mode,
$helper = Mage::helper('core'); //instantiate the core helper,
$obj->setHelper($helper); //set the encryptions helper,
$enc_pwd = $obj->getHash($pwd, 2); //get the password's hash
BTW, for info, you can check if you have entered a correct password by adding this line:
echo $obj->validateHash($pwd, $enc_pwd);
If it echoes 1 then the password is correct. Try it, it works for me.
6 comments
Very helpful - thanks! I was trying to figure out how to do this and your code was exactly what I was looking for.
Very nice!
Thanks!
U help a brazilian guy!
Lovely Article....Perfect...
Thanks Dear
Thank you very much. I used this code-snippet to realize a customer-import extension.
Thank you, very helpful!
Thanks. It works fine for me.
Post a Comment