From 339ed00eb7496fc44ec5113b0520838305062039 Mon Sep 17 00:00:00 2001 From: curly Date: Tue, 16 Jul 2024 13:36:30 -0600 Subject: delete user --- TODO | 4 ++-- src/main.js | 21 +++++++++++++++++++ src/user/delete/index.html | 48 ++++++++++++++++++++++++++++++++++++++++++++ src/user/index.html | 3 +++ src/user/transfer/index.html | 3 +++ src/user/update/index.html | 3 +++ 6 files changed, 80 insertions(+), 2 deletions(-) create mode 100644 src/user/delete/index.html diff --git a/TODO b/TODO index 108ba10..5c547a1 100644 --- a/TODO +++ b/TODO @@ -1,5 +1,5 @@ Token values and history graph on home User home for token values -Delete User Session Management -Logout All \ No newline at end of file +Logout All +Admin \ No newline at end of file diff --git a/src/main.js b/src/main.js index 1ef06e8..28013cd 100644 --- a/src/main.js +++ b/src/main.js @@ -292,4 +292,25 @@ async function update_form() { } else { alert(req.status + ": " + req.body) } +} + +async function delete_form() { + const id = get_id(); + const session = get_session(); + const is_sure = document.getElementById("is_sure").value; + + if (is_sure == "YES") { + const url = server + "/user/delete" + const body = {"id": id, "session": session} + const req = await xhttp_post(url, body); + + if (req.status == 200) { + del_session() + window.location.href = host + } else { + alert("Could not delete user!") + } + } else { + alert("You have to be sure to delete your user!") + } } \ No newline at end of file diff --git a/src/user/delete/index.html b/src/user/delete/index.html new file mode 100644 index 0000000..7d202f3 --- /dev/null +++ b/src/user/delete/index.html @@ -0,0 +1,48 @@ + + + + + + DELETE + + +
+ + + + + + + + + + + + + + + +
+
+
+

DELETE

+
+
+
+
+ + + +
+
+
+ + + \ No newline at end of file diff --git a/src/user/index.html b/src/user/index.html index ed20832..72cee0d 100644 --- a/src/user/index.html +++ b/src/user/index.html @@ -16,6 +16,9 @@ + + + diff --git a/src/user/transfer/index.html b/src/user/transfer/index.html index 5679af8..80dfa3b 100644 --- a/src/user/transfer/index.html +++ b/src/user/transfer/index.html @@ -16,6 +16,9 @@ + + + diff --git a/src/user/update/index.html b/src/user/update/index.html index efc2188..30d938b 100644 --- a/src/user/update/index.html +++ b/src/user/update/index.html @@ -16,6 +16,9 @@ + + + -- cgit v1.2.3