mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 08:56:36 +02:00
MDL-41408 redirect after incorrect login attempts
This commit is contained in:
parent
b69ec2889e
commit
17ccd3aa1b
1 changed files with 20 additions and 0 deletions
|
@ -247,6 +247,9 @@ if ($frm and isset($frm->username)) { // Login WITH
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Discard any errors before the last redirect.
|
||||||
|
unset($SESSION->loginerrormsg);
|
||||||
|
|
||||||
// test the session actually works by redirecting to self
|
// test the session actually works by redirecting to self
|
||||||
$SESSION->wantsurl = $urltogo;
|
$SESSION->wantsurl = $urltogo;
|
||||||
redirect(new moodle_url(get_login_url(), array('testsession'=>$USER->id)));
|
redirect(new moodle_url(get_login_url(), array('testsession'=>$USER->id)));
|
||||||
|
@ -334,6 +337,23 @@ foreach($authsequence as $authname) {
|
||||||
$potentialidps = array_merge($potentialidps, $authplugin->loginpage_idp_list($SESSION->wantsurl));
|
$potentialidps = array_merge($potentialidps, $authplugin->loginpage_idp_list($SESSION->wantsurl));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!empty($SESSION->loginerrormsg)) {
|
||||||
|
// We had some errors before redirect, show them now.
|
||||||
|
$errormsg = $SESSION->loginerrormsg;
|
||||||
|
unset($SESSION->loginerrormsg);
|
||||||
|
|
||||||
|
} else if ($testsession) {
|
||||||
|
// No need to redirect here.
|
||||||
|
unset($SESSION->loginerrormsg);
|
||||||
|
|
||||||
|
} else if ($errormsg or !empty($frm->password)) {
|
||||||
|
// We must redirect after every password submission.
|
||||||
|
if ($errormsg) {
|
||||||
|
$SESSION->loginerrormsg = $errormsg;
|
||||||
|
}
|
||||||
|
redirect(new moodle_url('/login/index.php'));
|
||||||
|
}
|
||||||
|
|
||||||
$PAGE->set_title("$site->fullname: $loginsite");
|
$PAGE->set_title("$site->fullname: $loginsite");
|
||||||
$PAGE->set_heading("$site->fullname");
|
$PAGE->set_heading("$site->fullname");
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue