Made the account manager get the name and date created of the user

This commit is contained in:
Tracker-Friendly 2024-05-16 17:48:35 +01:00
parent 153b53f48a
commit a5b32c32b8
1 changed files with 27 additions and 7 deletions

View File

@ -26,11 +26,31 @@
doStuff()
});
}
fetch("/api/userinfo", {
method: "POST",
body: JSON.stringify({
"secretKey": localStorage.getItem("DONOTSHARE-secretkey")
}),
headers: {
"Content-Type": "application/json; charset=UTF-8"
}
})
.then((response) => {
async function doStuff() {
const data = await response.json()
if (response.status === 200) {
document.getElementById("namebox").innerText = "Username: " + data.username;
document.getElementById("datebox").innerText = "Account created: " + new Date(data.created * 1000).toLocaleString();
}
}
doStuff()
});
</script>
<div class="newoauth" style="margin: 0;">
<h2>Account settings</h2>
<p>Name: </p>
<p>Created: </p>
<p id="namebox">Loading...</p>
<p id="datebox"></p>
<button onclick="parent.window.location.href = '/logout';">Logout</button><br style="">
<button onclick="deleteacct()" style="margin-top: 5px;">Delete Account</button>
</div>