62 lines
2.5 KiB
HTML
62 lines
2.5 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<link rel="stylesheet" href="/static/css/style.css" media="">
|
|
<script src="/static/js/dashboard.js"></script>
|
|
<title>User settings - {{ .identifier }}</title>
|
|
</head>
|
|
<body style="background-color: transparent;">
|
|
<script>
|
|
async function deleteacct() {
|
|
if (confirm("Are you SURE you would like to delete your account forever?") == true) {
|
|
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")
|
|
}),
|
|
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 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>
|
|
</body>
|
|
</html>
|