mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 17:06:53 +02:00
MDL-34101 do not try to authenticate non-existent users when user creation is prevented
This commit is contained in:
parent
13951f0ce7
commit
8956a329a6
1 changed files with 9 additions and 6 deletions
|
@ -4043,6 +4043,13 @@ function authenticate_user_login($username, $password) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Do not try to authenticate non-existent accounts when user creation is not disabled.
|
||||||
|
if (!empty($CFG->authpreventaccountcreation)) {
|
||||||
|
add_to_log(SITEID, 'login', 'error', 'index.php', $username);
|
||||||
|
error_log('[client '.getremoteaddr()."] $CFG->wwwroot Unknown user, can not create new accounts: $username ".$_SERVER['HTTP_USER_AGENT']);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// User does not exist
|
// User does not exist
|
||||||
$auths = $authsenabled;
|
$auths = $authsenabled;
|
||||||
$user = new stdClass();
|
$user = new stdClass();
|
||||||
|
@ -4074,12 +4081,8 @@ function authenticate_user_login($username, $password) {
|
||||||
$user = update_user_record($username);
|
$user = update_user_record($username);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// if user not found and user creation is not disabled, create it
|
// Create account, we verified above that user creation is allowed.
|
||||||
if (empty($CFG->authpreventaccountcreation)) {
|
$user = create_user_record($username, $password, $auth);
|
||||||
$user = create_user_record($username, $password, $auth);
|
|
||||||
} else {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$authplugin->sync_roles($user);
|
$authplugin->sync_roles($user);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue