Slon/Http/AdminServer: Allow deletion of users
This commit is contained in:
parent
fcc95d971b
commit
261c8454f5
2 changed files with 34 additions and 2 deletions
|
@ -70,9 +70,9 @@
|
|||
const accounts = await response.json();
|
||||
let html = "<h4 class=\"title is-4\">Accounts</h4><div class=spacer></div>";
|
||||
if (accounts.length) {
|
||||
html += "<table class=table><thead><tr><th>id</th><th>username</th></tr></head><tbody>";
|
||||
html += "<table class=table><thead><tr><th>id</th><th>acct</th><th>display_name</th><th>type</th><th>delete</th></tr></head><tbody>";
|
||||
for (let i = 0; i < accounts.length; i++) {
|
||||
html += "<tr><td>" + accounts[i]["id"] + "</td><td>" + accounts[i]["username"] + "</td><tr>";
|
||||
html += "<tr><td>" + accounts[i]["id"] + "</td><td>" + accounts[i]["acct"] + "</td><td>" + accounts[i]["display_name"] + "</td><td>"+ (accounts[i]["remote_actor"] == undefined ? "local" : "remote") + "</td><td style=\"text-align:center\"><a href=\"javascript:confirmDeleteUser('" + accounts[i]["acct"] + "','" + accounts[i]["id"] + "');\">❌</a></td><tr>";
|
||||
}
|
||||
html += "</tbody></table>";
|
||||
} else {
|
||||
|
@ -82,6 +82,14 @@
|
|||
setContent(html);
|
||||
setActiveLink("accounts");
|
||||
}
|
||||
async function confirmDeleteUser(user, id) {
|
||||
if(confirm("Are you sure you want to delete '" + user + "' ?")) {
|
||||
const request = new Request("/delete/account?id=" + id);
|
||||
const response = await fetch(request);
|
||||
const empty_json = await response.json();
|
||||
manageAccounts();
|
||||
}
|
||||
}
|
||||
function manageNewUser() {
|
||||
clearActiveLinks();
|
||||
let html = "<h4 class=\"title is-4\">New User</h4><div class=spacer></div>";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue