$authdb = $this->db_init();
- $rs = $authdb->Execute("SELECT {$this->config->fieldpass}
+ $rs = $authdb->Execute("SELECT {$this->config->fieldpass} AS userpass
FROM {$this->config->table}
WHERE {$this->config->fielduser} = '".$this->ext_addslashes($extusername)."'");
if (!$rs) {
return false;
}
- $fromdb = $rs->fields[$this->config->fieldpass];
+ $fields = array_change_key_case($rs->fields, CASE_LOWER);
+ $fromdb = $fields['userpass'];
$rs->Close();
$authdb->Close();
$DB->update_record('auth_db_users', $user3);
$this->assertTrue($auth->user_login('u3', 'heslo'));
+ require_once($CFG->libdir.'/password_compat/lib/password.php');
+ set_config('passtype', 'saltedcrypt', 'auth/db');
+ $auth->config->passtype = 'saltedcrypt';
+ $user3->pass = password_hash('heslo', PASSWORD_BCRYPT, array('salt' => 'best_salt_ever_moodle_rocks_dont_tell'));
+ $DB->update_record('auth_db_users', $user3);
+ $this->assertTrue($auth->user_login('u3', 'heslo'));
+
set_config('passtype', 'internal', 'auth/db');
$auth->config->passtype = 'internal';
create_user_record('u3', 'heslo', 'db');