Skip to content

Commit

Permalink
Merge branch 'MDL-76116-master' of https://github.com/meirzamoodle/mo…
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewnicols committed Dec 7, 2022
2 parents 81a7a50 + 883c1be commit bf5efe9
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
21 changes: 18 additions & 3 deletions admin/mnet/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand All @@ -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']))) {
Expand All @@ -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');
Expand Down
1 change: 1 addition & 0 deletions lang/en/mnet.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@
$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.';
Expand Down

0 comments on commit bf5efe9

Please sign in to comment.