MDL-37963 hash only given passwords in user generator

This commit is contained in:
Petr Škoda
2013-02-24 10:40:55 +01:00
parent f29e62cb6c
commit dbf60a042c
+6 -5
View File
@@ -176,8 +176,12 @@ EOD;
}
}
if (!isset($record['password'])) {
$record['password'] = 'lala';
if (isset($record['password'])) {
$record['password'] = hash_internal_user_password($record['password']);
} else {
// The auth plugin may not fully support this,
// but it is still better/faster than hashing random stuff.
$record['password'] = AUTH_PASSWORD_NOT_CACHED;
}
if (!isset($record['email'])) {
@@ -204,9 +208,6 @@ EOD;
$record['timemodified'] = $record['timecreated'];
$record['lastip'] = '0.0.0.0';
// Use fast hash during testing.
$record['password'] = hash_internal_user_password($record['password'], true);
if ($record['deleted']) {
$delname = $record['email'].'.'.time();
while ($DB->record_exists('user', array('username'=>$delname))) {