MDL-63183 auth_shibboleth: Don't render page when already logged in

This commit is contained in:
Jun Pataleta 2018-10-24 12:36:56 +08:00 committed by Jenkins
parent 5f9955b5a0
commit e862985a69

View File

@ -62,7 +62,19 @@
$PAGE->set_heading($site->fullname);
echo $OUTPUT->header();
include("index_form.html");
if (isloggedin() and !isguestuser()) {
// Prevent logging when already logged in, we do not want them to relogin by accident because sesskey would be changed.
echo $OUTPUT->box_start();
$params = array('sesskey' => sesskey(), 'loginpage' => 1);
$logout = new single_button(new moodle_url('/login/logout.php', $params), get_string('logout'), 'post');
$continue = new single_button(new moodle_url('/'), get_string('cancel'), 'get');
echo $OUTPUT->confirm(get_string('alreadyloggedin', 'error', fullname($USER)), $logout, $continue);
echo $OUTPUT->box_end();
} else {
include("index_form.html");
}
echo $OUTPUT->footer();