mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 14:27:22 +01:00
MDL-23474 user password hashing - removed unnecessary user record update, improved docs and fixed the content of password field in user record after update
This commit is contained in:
parent
0bf8c17431
commit
003ffc8565
@ -3749,11 +3749,9 @@ function hash_internal_user_password($password) {
|
||||
/**
|
||||
* Update password hash in user object.
|
||||
*
|
||||
* @global object
|
||||
* @global object
|
||||
* @param object $user
|
||||
* @param string $password plain text password
|
||||
* @return bool true if hash changed
|
||||
* @return bool always returns true
|
||||
*/
|
||||
function update_internal_user_password(&$user, $password) {
|
||||
global $CFG, $DB;
|
||||
@ -3765,7 +3763,11 @@ function update_internal_user_password(&$user, $password) {
|
||||
$hashedpassword = hash_internal_user_password($password);
|
||||
}
|
||||
|
||||
$DB->set_field('user', 'password', $hashedpassword, array('id'=>$user->id));
|
||||
if ($user->password !== $hashedpassword) {
|
||||
$DB->set_field('user', 'password', $hashedpassword, array('id'=>$user->id));
|
||||
$user->password = $hashedpassword;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user