mirror of
https://github.com/moodle/moodle.git
synced 2025-08-06 01:16:44 +02:00
Updated bugfix according to Jerome suggestions
password check is done at lib.php instead of externallib.php Conflicts: user/lib.php
This commit is contained in:
parent
5fc420e2ed
commit
9e63c0ff71
1 changed files with 13 additions and 3 deletions
14
user/lib.php
14
user/lib.php
|
@ -70,14 +70,24 @@ function user_update_user($user) {
|
||||||
$user = (object)$user;
|
$user = (object)$user;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// hash the password
|
//MDL-30878
|
||||||
$user->password = hash_internal_user_password($user->password);
|
//unset password here, for updating later
|
||||||
|
if (isset($user->password)) {
|
||||||
|
$passwd = $user->password;
|
||||||
|
unset($user->password);
|
||||||
|
}
|
||||||
|
|
||||||
$user->timemodified = time();
|
$user->timemodified = time();
|
||||||
$DB->update_record('user', $user);
|
$DB->update_record('user', $user);
|
||||||
|
|
||||||
/// trigger user_updated event on the full database user row
|
/// trigger user_updated event on the full database user row
|
||||||
$updateduser = $DB->get_record('user', array('id' => $user->id));
|
$updateduser = $DB->get_record('user', array('id' => $user->id));
|
||||||
|
|
||||||
|
//MDL-30878
|
||||||
|
//if password was set, then update its hash
|
||||||
|
if (isset($passwd))
|
||||||
|
update_internal_user_password($updateduser, $passwd);
|
||||||
|
|
||||||
events_trigger('user_updated', $updateduser);
|
events_trigger('user_updated', $updateduser);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue