I want to create an API point where the admin user can update their password, but I don't know what encrypt method used to encrypt the admin password and save it in the database, roughly what I want is like this:
$data = array(
'user_id' => '1',
'password' => 'magento2',
'firstname' => 'Jane'
);
$user = Mage::getModel('admin/user')->load($id);
if(isset($data['password')) $data['password'] = $this->encryptPassword($data['password']);
$user->addData($data);
$user->save();
Best Answer
In Magento 1.x, the admin password is saved as
CONCAT(MD5('qXpassword'), ':qX')
, where 'qX' is salt value for encryption and it can be any other string.If you don't use salt concatenation, i.e. use a blank salt value, then you can simply use:
to save the password of the admin user.
I hope I was clear enough to explain.
Please let me know if you have any confusion.