MDL-27884 Implement proper username validation during csv import

This commit is contained in:
Ankit Agarwal
2013-01-02 14:09:13 +08:00
parent 9da506c2a3
commit 7bf99ee558
2 changed files with 6 additions and 1 deletions
+5 -1
View File
@@ -285,7 +285,11 @@ if ($formdata = $mform2->is_cancelled()) {
$userserrors++;
continue;
}
if ($user->username !== clean_param($user->username, PARAM_USERNAME)) {
$upt->track('status', get_string('invalidusername', 'error', 'username'), 'error');
$upt->track('username', $errorstr, 'error');
$userserrors++;
}
if ($existinguser = $DB->get_record('user', array('username'=>$user->username, 'mnethostid'=>$CFG->mnet_localhost_id))) {
$upt->track('id', $existinguser->id, 'normal', false);
}