support: Add option to delete user from /activity/support.

This commit is contained in:
Mateusz Mandera
2023-05-15 23:40:35 +02:00
committed by Tim Abbott
parent 386d87635e
commit 632e856240
4 changed files with 63 additions and 0 deletions

View File

@@ -18,6 +18,31 @@ $(() => {
}
});
$("body").on("click", ".delete-user-button", function (e) {
e.preventDefault();
const message =
"Confirm the email of the user you want to delete.\n\n WARNING! This action is irreversible!";
const actual_email = $(this).attr("data-email");
// eslint-disable-next-line no-alert
const confirmed_email = window.prompt(message);
if (confirmed_email === actual_email) {
const actual_string_id = $(this).attr("data-string-id");
// eslint-disable-next-line no-alert
const confirmed_string_id = window.prompt(
"Now provide string_id of the realm to confirm.",
);
if (confirmed_string_id === actual_string_id) {
this.form.submit();
} else {
// eslint-disable-next-line no-alert
window.alert("The string_id you entered is not correct. Aborted.");
}
} else {
// eslint-disable-next-line no-alert
window.alert("The email you entered is not correct. Aborted.");
}
});
$("a.copy-button").on("click", function () {
common.copy_data_attribute_value($(this), "copytext");
});