Encrypt customers magento password after data import

+1 vote
182 views
asked Nov 16, 2016 in Magento by Susan
How is it possible to encrypt customers magento password after data import?

1 Answer

0 votes
answered Nov 16, 2016 by Just a reader
<?php

error_reporting(E_ALL | E_STRICT);
$mageFilename = 'app/Mage.php';
if (!file_exists($mageFilename)) {
    echo $mageFilename." was not found";
    exit;
}
require_once $mageFilename;
Varien_Profiler::enable();
Mage::setIsDeveloperMode(true);
ini_set('display_errors', 1);
umask(0);
Mage::app(); 

//get all customers

$customers = Mage::getModel('customer/customer')->getCollection();


//Loop to get a single customer informations

foreach ($customers as $customer){
   
   
   // Get customers extanded Data by email
    $customerpass = Mage::getModel('customer/customer')
 ->setWebsiteId(Mage::app()->getStore()->getWebsiteId())
 ->loadByEmail($customer->getEmail());


// Get current password (No hashed PW)
$pass = $customerpass->getData("password_hash");
 $salt = "at";
 $password = md5($salt.$pass).":".$salt;
   
   //Save hashed password     
        $customer->setPasswordHash($password)->save();
}

echo "Thats it!";

?>

Related questions

+2 votes
0 answers 141 views
0 votes
3 answers 265 views
0 votes
1 answer 200 views
+1 vote
1 answer 402 views
0 votes
0 answers 309 views
0 votes
1 answer 250 views
asked Jul 11, 2016 in Magento by Roger Dodd
...