mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 08:22:07 +02:00
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:
parent
dcfb30bb16
commit
05b18caf51
@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user