From dc7a91ceeca79e01b53662b48a5e7252dc33a3f8 Mon Sep 17 00:00:00 2001 From: curly Date: Tue, 16 Jul 2024 13:14:41 -0600 Subject: update user info --- src/index.html | 9 ++++---- src/login.html | 40 ---------------------------------- src/login/index.html | 41 ++++++++++++++++++++++++++++++++++ src/main.js | 38 +++++++++++++++++++++++++++++--- src/register.html | 42 ----------------------------------- src/register/index.html | 43 ++++++++++++++++++++++++++++++++++++ src/transfer.html | 48 ---------------------------------------- src/user.html | 44 ------------------------------------- src/user/index.html | 48 ++++++++++++++++++++++++++++++++++++++++ src/user/transfer/index.html | 52 ++++++++++++++++++++++++++++++++++++++++++++ src/user/update/index.html | 46 +++++++++++++++++++++++++++++++++++++++ 11 files changed, 270 insertions(+), 181 deletions(-) delete mode 100644 src/login.html create mode 100644 src/login/index.html delete mode 100644 src/register.html create mode 100644 src/register/index.html delete mode 100644 src/transfer.html delete mode 100644 src/user.html create mode 100644 src/user/index.html create mode 100644 src/user/transfer/index.html create mode 100644 src/user/update/index.html diff --git a/src/index.html b/src/index.html index 330c493..5beafaf 100644 --- a/src/index.html +++ b/src/index.html @@ -1,18 +1,19 @@ - - + + + POKO
- + - +
diff --git a/src/login.html b/src/login.html deleted file mode 100644 index 1b629cc..0000000 --- a/src/login.html +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - -
- - - - - - - - - -
-
-
-

LOGIN

-
-
-
-
- - - - - -
-
-
- - - \ No newline at end of file diff --git a/src/login/index.html b/src/login/index.html new file mode 100644 index 0000000..ac01fd3 --- /dev/null +++ b/src/login/index.html @@ -0,0 +1,41 @@ + + + + + + LOGIN + + +
+ + + + + + + + + +
+
+
+

LOGIN

+
+
+
+
+ + + + + +
+
+
+ + + \ No newline at end of file diff --git a/src/main.js b/src/main.js index e6cadce..1ef06e8 100644 --- a/src/main.js +++ b/src/main.js @@ -62,7 +62,7 @@ async function register() { if (req.status == 201) { await login(req.body.id, password) - window.location.href = host + "/user.html" + window.location.href = host + "/user/" } else { alert(req.status + ": " + req.body) } @@ -87,7 +87,7 @@ async function login(id, password) { if (req.status == 200) { // Set session cookie set_session(req.body, id) - window.location.href = host + "/user.html"; + window.location.href = host + "/user/"; } else { alert(req.status + ": " + req.body) } @@ -246,7 +246,7 @@ async function transfer(to_id, color, amount) { if (req.status != 200) { alert(req.status + ":" + req.body) } else if (req.status == 200) { - window.location.href = host + "/user.html" + window.location.href = host + "/user/" } } } @@ -260,4 +260,36 @@ function transfer_form() { console.log(to_id, color, amount) transfer(to_id, color, amount) +} + +async function update_form_onload() { + const name = document.getElementById("name"); + const id = get_id(); + const session = get_session(); + + const url = server + "/user/get" + const body = {"id": id, "session": session} + const req = await xhttp_post(url, body); + + if (req.status == 200) { + name.value = req.body.name; + } +} + +async function update_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 req = await xhttp_post(url, body); + + if (req.status == 200) { + window.location.href = host + "/user/" + } else { + alert(req.status + ": " + req.body) + } } \ No newline at end of file diff --git a/src/register.html b/src/register.html deleted file mode 100644 index 77902f9..0000000 --- a/src/register.html +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - -
- - - - - - - - - -
-
-
-

REGISTER

-
-
-
-
- - - - - - - -
-
-
- - - \ No newline at end of file diff --git a/src/register/index.html b/src/register/index.html new file mode 100644 index 0000000..d4e29c7 --- /dev/null +++ b/src/register/index.html @@ -0,0 +1,43 @@ + + + + + + REGISTER + + +
+ + + + + + + + + +
+
+
+

REGISTER

+
+
+
+
+ + + + + + + +
+
+
+ + + \ No newline at end of file diff --git a/src/transfer.html b/src/transfer.html deleted file mode 100644 index 0802711..0000000 --- a/src/transfer.html +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - - -
- - - - - - - - - -
-
-
-

TRANSFER

-
-
-
-
- - - - - - - -
-
-
- - - \ No newline at end of file diff --git a/src/user.html b/src/user.html deleted file mode 100644 index 00bfad6..0000000 --- a/src/user.html +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - -
- - - - - - - - - -
-
-
-

USER

-
-
-
-
-

User Info

-

-

-
-
-

Tokens Balance

-
-
-

Users

-
-
-
- - - \ No newline at end of file diff --git a/src/user/index.html b/src/user/index.html new file mode 100644 index 0000000..ed20832 --- /dev/null +++ b/src/user/index.html @@ -0,0 +1,48 @@ + + + + + + USER + + +
+ + + + + + + + + + + + +
+
+
+

USER

+
+
+
+
+

User Info

+

+

+
+
+

Tokens Balance

+
+
+

Users

+
+
+
+ + + \ No newline at end of file diff --git a/src/user/transfer/index.html b/src/user/transfer/index.html new file mode 100644 index 0000000..5679af8 --- /dev/null +++ b/src/user/transfer/index.html @@ -0,0 +1,52 @@ + + + + + + TRANSFER + + +
+ + + + + + + + + + + + +
+
+
+

TRANSFER

+
+
+
+
+ + + + + + + +
+
+
+ + + \ No newline at end of file diff --git a/src/user/update/index.html b/src/user/update/index.html new file mode 100644 index 0000000..efc2188 --- /dev/null +++ b/src/user/update/index.html @@ -0,0 +1,46 @@ + + + + + + UPDATE INFO + + +
+ + + + + + + + + + + + +
+
+
+

UPDATE INFO

+
+
+
+
+ + + + + + + +
+
+
+ + + \ No newline at end of file -- cgit v1.2.3