Update user Password

Update a user password in a Joomla profile form.

Overview

The issue arises when manually updating the Joomla users table via PHP without using the proper Joomla password encryption method.
Use Joomla's UserHelper methods to correctly generate a salt and encrypt the new password before saving it to the database.

Answered
BN BNDragon 23 Jan, 2015
Hi there,

I'm making a edit profile form, and have a issue to solve.

How to update user password?

I'm making the saving in db by php, not a db save action.
And, until better solution, I'm saving the user avatar with a file upload action (but i want to make it with php too because I don't know how to change the name of file and/or catch/insert the name in the db)

I'm updating 3 tables in my form:
(Joomla)users->email/password
(CB)comprofiler->Self Data (name, location, occupation, avatar...)
(Custom/HybridAuth)->proveider_uid, password(encrypted by custom function),....

The problem here is how to update in user table :/

Please help.
BN
Gr GreyHead 24 Jan, 2015
Hi BN,

By far the easiest way is to use the Joomla! User methods in a Custom Code action.

Bob
BN BNDragon 26 Jan, 2015
Hi Bob,

Thanks for your reply,

Can you tell me witch method should I use?
I'm not familiarly with then😟

I really appreciate your help in this case.

BN
BN BNDragon 26 Jan, 2015
Answer
Hi,

I found a solution.
$salt = JUserHelper::genRandomPassword(32);
$crypt = JUserHelper::getCryptedPassword($form->data['newPass'], $salt);
$password = $crypt.':'.$salt;


Thanks for your help Bob🙂

BN
This topic is locked and no more replies can be posted.