From cc46857b4361c356e079b48d23a16b0fccaa7a61 Mon Sep 17 00:00:00 2001 From: curly Date: Wed, 17 Jul 2024 14:27:04 -0600 Subject: separate user update forms. require password for deletion --- src/favicon.ico | Bin 0 -> 9662 bytes src/favicon.svg | 46 +++++++++++++++++++++++++++++++++++++++++++ src/index.html | 4 ++-- src/login/index.html | 4 ++-- src/main.css | 10 +++++----- src/main.js | 26 +++++++++++++++++++----- src/register/index.html | 4 ++-- src/user/delete/index.html | 6 ++++-- src/user/index.html | 4 ++-- src/user/transfer/index.html | 4 ++-- src/user/update/index.html | 19 ++++++++++++++---- 11 files changed, 101 insertions(+), 26 deletions(-) create mode 100644 src/favicon.svg (limited to 'src') diff --git a/src/favicon.ico b/src/favicon.ico index e69de29..9efc4f9 100644 Binary files a/src/favicon.ico and b/src/favicon.ico differ diff --git a/src/favicon.svg b/src/favicon.svg new file mode 100644 index 0000000..2c131bd --- /dev/null +++ b/src/favicon.svg @@ -0,0 +1,46 @@ + + + + + + + + + + + PO + KO + + + diff --git a/src/index.html b/src/index.html index 5beafaf..9a38dca 100644 --- a/src/index.html +++ b/src/index.html @@ -17,12 +17,12 @@ -
+

POKO


-
+

Welcome to POKO! Just a little server and web interface to exchange POKO tokens. diff --git a/src/login/index.html b/src/login/index.html index ac01fd3..461b040 100644 --- a/src/login/index.html +++ b/src/login/index.html @@ -17,12 +17,12 @@

-
+

LOGIN


-
+
diff --git a/src/main.css b/src/main.css index a5c93bd..20b8531 100644 --- a/src/main.css +++ b/src/main.css @@ -21,7 +21,7 @@ body { height: 100vh; width: 100vw; } -#page { +.page { flex-grow: 1; max-width: 65vw; min-width: 45vw; @@ -37,7 +37,7 @@ hr { color: var(--text-primary); width: 100%; } -#content { +.content { flex-grow: 1; display: flex; flex-direction: row; @@ -122,7 +122,7 @@ form > select.button { align-self: start; } -#page > center > h2 { +.page > center > h2 { margin-top: 12px; margin-bottom: 12px; } @@ -153,11 +153,11 @@ header > a, header > a:visited, header > a:link { } @media screen and (max-width: 800px) { - #page { + .page { max-width: 100vw; min-width: 90vw; } - #content > div { + .content > div { width: 100%; max-width: unset; } diff --git a/src/main.js b/src/main.js index 28013cd..f970abc 100644 --- a/src/main.js +++ b/src/main.js @@ -276,15 +276,29 @@ async function update_form_onload() { } } -async function update_form() { +async function update_password_form() { const id = get_id(); const session = get_session(); - const name = document.getElementById("name").value; const old_password = document.getElementById("old_password").value; const new_password = document.getElementById("new_password").value; - const url = server + "/user/update/info" - const body = {"id": id, "session": session, "name": name, "old_password": old_password, "new_password": new_password}; + const url = server + "/user/update/password" + const body = {"id": id, "session": session, "old_password": old_password, "new_password": new_password}; + const req = await xhttp_post(url, body); + + if (req.status == 200) { + window.location.href = host + "/user/" + } else { + alert(req.status + ": " + req.body) + } +} +async function update_name_form() { + const id = get_id(); + const session = get_session(); + const name = document.getElementById("name").value; + + const url = server + "/user/update/name" + const body = {"id": id, "session": session, "name": name}; const req = await xhttp_post(url, body); if (req.status == 200) { @@ -292,16 +306,18 @@ 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; + const password = document.getElementById("password").value; if (is_sure == "YES") { const url = server + "/user/delete" - const body = {"id": id, "session": session} + const body = {"id": id, "session": session, "password": password} const req = await xhttp_post(url, body); if (req.status == 200) { diff --git a/src/register/index.html b/src/register/index.html index d4e29c7..38bcef7 100644 --- a/src/register/index.html +++ b/src/register/index.html @@ -17,12 +17,12 @@ -
+

REGISTER


-
+
diff --git a/src/user/delete/index.html b/src/user/delete/index.html index 7d202f3..1b083c3 100644 --- a/src/user/delete/index.html +++ b/src/user/delete/index.html @@ -23,18 +23,20 @@ -
+

DELETE


-
+
+ +
diff --git a/src/user/index.html b/src/user/index.html index 72cee0d..12fd680 100644 --- a/src/user/index.html +++ b/src/user/index.html @@ -23,12 +23,12 @@ -
+

USER


-
+

User Info

diff --git a/src/user/transfer/index.html b/src/user/transfer/index.html index 80dfa3b..479ff13 100644 --- a/src/user/transfer/index.html +++ b/src/user/transfer/index.html @@ -23,12 +23,12 @@ -
+

TRANSFER


-
+
diff --git a/src/user/update/index.html b/src/user/update/index.html index 30d938b..0ec244b 100644 --- a/src/user/update/index.html +++ b/src/user/update/index.html @@ -23,15 +23,26 @@ -
+
-

UPDATE INFO

+

UPDATE NAME


-
- +
+ + + +
+
+
+
+

UPDATE PASSWORD

+
+
+
+
-- cgit v1.2.3