Merge branch 'MDL-76116-master' of https://github.com/meirzamoodle/moodle

This commit is contained in:
Andrew Nicols 2022-12-08 06:14:24 +08:00
commit bf5efe9d0b
2 changed files with 19 additions and 3 deletions

View File

@ -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');

View File

@ -110,6 +110,7 @@ $string['is_in_range'] = 'The IP address <code>{$a}</code> 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.';