Merged as MOODLE_15_STABLE: Accounts that are created with no authentication shouldn't allow non alphanumeric usernames, fixing in login/index.php as the auth library can't pass error messages. Fixes bug #4192

This commit is contained in:
mjollnir_ 2005-12-12 03:17:08 +00:00
parent dcfb30bb16
commit 05b18caf51

View File

@ -99,11 +99,21 @@
$frm->username = trim(moodle_strtolower($frm->username));
if ($CFG->auth == 'none' && empty($CFG->extendedusernamechars)) {
$string = eregi_replace("[^(-\.[:alnum:])]", "", $frm->username);
if (strcmp($frm->username, $string)) {
$errormsg = get_string('username').': '.get_string("alphanumerical");
$user = null;
}
}
if (($frm->username == 'guest') and empty($CFG->guestloginbutton)) {
$user = false; /// Can't log in as guest if guest button is disabled
$frm = false;
} else if (!$user) {
$user = authenticate_user_login($frm->username, $frm->password);
if (empty($errormsg)) {
$user = authenticate_user_login($frm->username, $frm->password);
}
}
update_login_count();
@ -189,7 +199,9 @@
exit;
} else {
$errormsg = get_string("invalidlogin");
if (empty($errormsg)) {
$errormsg = get_string("invalidlogin");
}
}
}