diff --git a/enrol/authorize/enrol.php b/enrol/authorize/enrol.php index 6354a79ccf0..bb93214a180 100755 --- a/enrol/authorize/enrol.php +++ b/enrol/authorize/enrol.php @@ -638,7 +638,7 @@ class enrolment_plugin_authorize } if (isset($SESSION->ccpaid)) { unset($SESSION->ccpaid); - redirect($CFG->wwwroot . '/login/logout.php'); + redirect($CFG->wwwroot . '/login/logout.php?sesskey='.sesskey()); return; } } diff --git a/lang/en_utf8/moodle.php b/lang/en_utf8/moodle.php index 8f63373d16c..a541d5b81f7 100644 --- a/lang/en_utf8/moodle.php +++ b/lang/en_utf8/moodle.php @@ -746,6 +746,7 @@ $string['loginstepsnone'] = '
Hi!
$string['loginto'] = 'Login to $a'; $string['loginusing'] = 'Login here using your username and password'; $string['logout'] = 'Logout'; +$string['logoutconfirm'] = 'Do you really want to logout?'; $string['logs'] = 'Logs'; $string['logtoomanycourses'] = ' [ url\">more ] '; $string['logtoomanyusers'] = ' [ url\">more ] '; diff --git a/lib/weblib.php b/lib/weblib.php index 061c8934e15..c553cd6fe4c 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -2463,7 +2463,7 @@ function user_login_string($course=NULL, $user=NULL) { " (framename}\" href=\"$wwwroot/login/index.php\">".get_string('login').')'; } else { $loggedinas = $realuserinfo.get_string('loggedinas', 'moodle', $username).' '.$instudentview. - " (framename}\" href=\"$CFG->wwwroot/login/logout.php\">".get_string('logout').')'; + " (framename}\" href=\"$CFG->wwwroot/login/logout.php?sesskey=".sesskey()."\">".get_string('logout').')'; } } else { $loggedinas = get_string('loggedinnot', 'moodle'). diff --git a/login/logout.php b/login/logout.php index df49f2a3280..35a6929cff8 100644 --- a/login/logout.php +++ b/login/logout.php @@ -3,6 +3,16 @@ require_once("../config.php"); + + $sesskey = optional_param('sesskey', '__notpresent__', PARAM_RAW); // we want not null default to prevent required sesskey warning + + if (!confirm_sesskey($sesskey)) { + print_header($SITE->fullname, $SITE->fullname, 'home'); + notice_yesno(get_string('logoutconfirm'), 'logout.php?sesskey='.sesskey(), $CFG->wwwroot.'/'); + print_footer(); + die; + } + require_logout(); redirect("$CFG->wwwroot/");