user library MDL-21899 fix password not hashed

This commit is contained in:
jerome mouneyrac 2010-03-24 03:02:17 +00:00
parent 230ec40140
commit bd0f26bd05

View File

@ -37,13 +37,18 @@ function user_create_user($user) {
if (!is_object($user)) {
$user = (object)$user;
}
/// hash the password
$user->password = hash_internal_user_password($user->password);
$user->timecreated = time();
$user->timemodified = $user->timecreated;
/// insert the user into the database
$newuserid = $DB->insert_record('user', $user);
return $newuserid;
}
/**
@ -52,7 +57,16 @@ function user_create_user($user) {
*/
function user_update_user($user) {
global $DB;
$user['timemodified'] = time();
/// set the timecreate field to the current time
if (!is_object($user)) {
$user = (object)$user;
}
/// hash the password
$user->password = hash_internal_user_password($user->password);
$user->timemodified = time();
$DB->update_record('user', $user);
}