Skip to content

Commit

Permalink
MDL-63183 auth_shibboleth: Don't render page when already logged in
Browse files Browse the repository at this point in the history
  • Loading branch information
junpataleta authored and Jenkins committed Nov 6, 2018
1 parent 5f9955b commit e862985
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion auth/shibboleth/login.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();


0 comments on commit e862985

Please sign in to comment.