mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 08:56:36 +02:00
Merged from MOODLE_15_STABLE - auth - bugfixes: update_userinfo() did not truncate values, and did not have proper errorhandling; user creatiwas passing an id to set_user_preference when we wanted an object
This commit is contained in:
parent
125b1645ff
commit
4b598ff45b
1 changed files with 4 additions and 2 deletions
|
@ -2434,7 +2434,7 @@ function create_user_record($username, $password, $auth='') {
|
||||||
if (insert_record('user', $newuser)) {
|
if (insert_record('user', $newuser)) {
|
||||||
$user = get_complete_user_data('username', $newuser->username);
|
$user = get_complete_user_data('username', $newuser->username);
|
||||||
if($CFG->{'auth_'.$newuser->auth.'_forcechangepassword'}){
|
if($CFG->{'auth_'.$newuser->auth.'_forcechangepassword'}){
|
||||||
set_user_preference('auth_forcepasswordchange', 1, $user);
|
set_user_preference('auth_forcepasswordchange', 1, $user->id);
|
||||||
}
|
}
|
||||||
return $user;
|
return $user;
|
||||||
}
|
}
|
||||||
|
@ -2458,11 +2458,13 @@ function update_user_record($username) {
|
||||||
$authconfig = get_config('auth/' . $oldinfo->auth);
|
$authconfig = get_config('auth/' . $oldinfo->auth);
|
||||||
|
|
||||||
if ($newinfo = auth_get_userinfo($username)) {
|
if ($newinfo = auth_get_userinfo($username)) {
|
||||||
|
$newinfo = truncate_userinfo($newinfo);
|
||||||
foreach ($newinfo as $key => $value){
|
foreach ($newinfo as $key => $value){
|
||||||
$confkey = 'field_updatelocal_' . $key;
|
$confkey = 'field_updatelocal_' . $key;
|
||||||
if (!empty($authconfig->$confkey) && $authconfig->$confkey === 'onlogin') {
|
if (!empty($authconfig->$confkey) && $authconfig->$confkey === 'onlogin') {
|
||||||
$value = addslashes(stripslashes($value)); // Just in case
|
$value = addslashes(stripslashes($value)); // Just in case
|
||||||
set_field('user', $key, $value, 'username', $username);
|
set_field('user', $key, $value, 'username', $username)
|
||||||
|
|| error_log("Error updating $key for $username");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue