Made the account manager get the name and date created of the user
This commit is contained in:
parent
153b53f48a
commit
a5b32c32b8
|
@ -6,8 +6,28 @@
|
|||
</head>
|
||||
<body>
|
||||
<script>
|
||||
async function deleteacct() {
|
||||
await fetch(remote + "/api/deleteaccount", {
|
||||
async function deleteacct() {
|
||||
await fetch(remote + "/api/deleteaccount", {
|
||||
method: "POST",
|
||||
body: JSON.stringify({
|
||||
"secretKey": localStorage.getItem("DONOTSHARE-secretkey")
|
||||
}),
|
||||
headers: {
|
||||
"Content-Type": "application/json; charset=UTF-8"
|
||||
}
|
||||
})
|
||||
.then((response) => response)
|
||||
.then((response) => {
|
||||
async function doStuff() {
|
||||
if (response.status === 200) {
|
||||
parent.window.location.href = '/logout';
|
||||
}
|
||||
}
|
||||
doStuff()
|
||||
});
|
||||
}
|
||||
|
||||
fetch("/api/userinfo", {
|
||||
method: "POST",
|
||||
body: JSON.stringify({
|
||||
"secretKey": localStorage.getItem("DONOTSHARE-secretkey")
|
||||
|
@ -16,21 +36,21 @@
|
|||
"Content-Type": "application/json; charset=UTF-8"
|
||||
}
|
||||
})
|
||||
.then((response) => response)
|
||||
.then((response) => {
|
||||
async function doStuff() {
|
||||
const data = await response.json()
|
||||
if (response.status === 200) {
|
||||
parent.window.location.href = '/logout';
|
||||
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>
|
||||
|
|
Reference in New Issue