diff --git a/admin/mnet/index.php b/admin/mnet/index.php index ed4ff7df8a9..360e092f676 100644 --- a/admin/mnet/index.php +++ b/admin/mnet/index.php @@ -46,11 +46,23 @@ $formcontinue = new single_button(new moodle_url('index.php', array('confirm' => md5($mnet->public_key))), get_string('yes')); $formcancel = new single_button(new moodle_url('index.php', array()), get_string('no')); + + echo $OUTPUT->header(); echo $OUTPUT->confirm(get_string("deletekeycheck", "mnet"), $formcontinue, $formcancel); + echo $OUTPUT->footer(); exit; } else { // We're deleting + // If no/cancel then redirect back to the network setting page. + if (!isset($form->confirm)) { + redirect( + new moodle_url('/admin/mnet/index.php'), + get_string('keydeletedcancelled', 'mnet'), + null, + \core\output\notification::NOTIFY_SUCCESS + ); + } if (!isset($SESSION->mnet_confirm_delete_key)) { // fail - you're being attacked? @@ -63,8 +75,12 @@ if($time < time() - 60) { // fail - you're out of time. - throw new \moodle_exception ('deleteoutoftime', 'mnet', 'index.php'); - exit; + redirect( + new moodle_url('/admin/mnet/index.php'), + get_string('deleteoutoftime', 'mnet'), + null, + \core\output\notification::NOTIFY_WARNING + ); } if ($key != md5(sha1($mnet->keypair['keypair_PEM']))) { @@ -75,7 +91,6 @@ $mnet->replace_keys(); redirect('index.php', get_string('keydeleted','mnet')); - exit; } } $hosts = $DB->get_records_select('mnet_host', "id <> ? AND deleted = 0", array($CFG->mnet_localhost_id), 'wwwroot ASC'); diff --git a/lang/en/mnet.php b/lang/en/mnet.php index b69c0a22e4b..ec6791942f1 100644 --- a/lang/en/mnet.php +++ b/lang/en/mnet.php @@ -110,6 +110,7 @@ $string['is_in_range'] = 'The IP address {$a} represents a valid tr $string['ispublished'] = '{$a} has enabled this service for you.'; $string['issubscribed'] = '{$a} is subscribing to this service on your host.'; $string['keydeleted'] = 'Your key has been successfully deleted and replaced.'; +$string['keydeletedcancelled'] = 'The key deletion process has been cancelled.'; $string['keymismatch'] = 'The public key you are holding for this host is different from the public key it is currently publishing. The currently published key is:'; $string['last_connect_time'] = 'Last connect time'; $string['last_connect_time_help'] = 'The time that you last connected to this host.';