mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 08:56:36 +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
16
user/lib.php
16
user/lib.php
|
@ -69,15 +69,25 @@ function user_update_user($user) {
|
|||
if (!is_object($user)) {
|
||||
$user = (object)$user;
|
||||
}
|
||||
|
||||
/// hash the password
|
||||
$user->password = hash_internal_user_password($user->password);
|
||||
|
||||
//MDL-30878
|
||||
//unset password here, for updating later
|
||||
if (isset($user->password)) {
|
||||
$passwd = $user->password;
|
||||
unset($user->password);
|
||||
}
|
||||
|
||||
$user->timemodified = time();
|
||||
$DB->update_record('user', $user);
|
||||
|
||||
/// trigger user_updated event on the full database user row
|
||||
$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);
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue