Permalink
Browse files

auth - bugfixes: update_userinfo() did not truncate values, and did n…

…ot have proper errorhandling; user creatiwas passing an id to set_user_preference when we wanted an object
  • Loading branch information...
1 parent e1a3a68 commit 8ade954b604a4c2ddeb2e873cfc27dff500c24e2 martinlanghoff committed Sep 2, 2005
Showing with 4 additions and 2 deletions.
  1. +4 −2 lib/moodlelib.php
View
6 lib/moodlelib.php
@@ -2220,7 +2220,7 @@ function create_user_record($username, $password, $auth='') {
if (insert_record('user', $newuser)) {
$user = get_complete_user_data('username', $newuser->username);
if($CFG->{'auth_'.$newuser->auth.'_forcechangepassword'}){
- set_user_preference('auth_forcepasswordchange', 1, $user);
+ set_user_preference('auth_forcepasswordchange', 1, $user->id);
}
return $user;
}
@@ -2244,11 +2244,13 @@ function update_user_record($username) {
$authconfig = get_config('auth/' . $oldinfo->auth);
if ($newinfo = auth_get_userinfo($username)) {
+ $newinfo = truncate_userinfo($newinfo);
foreach ($newinfo as $key => $value){
$confkey = 'field_updatelocal_' . $key;
if (!empty($authconfig->$confkey) && $authconfig->$confkey === 'onlogin') {
$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");
}
}
}

0 comments on commit 8ade954

Please sign in to comment.