Added account management

This commit is contained in:
Tracker-Friendly 2024-05-16 17:34:51 +01:00
parent f840e627de
commit 153b53f48a
5 changed files with 63 additions and 0 deletions

View File

@ -422,6 +422,10 @@ func main() {
c.HTML(200, "dashboard.html", gin.H{}) c.HTML(200, "dashboard.html", gin.H{})
}) })
router.GET("/account", func(c *gin.Context) {
c.HTML(200, "acct.html", gin.H{})
})
router.GET("/aeskeyshare", func(c *gin.Context) { router.GET("/aeskeyshare", func(c *gin.Context) {
c.HTML(200, "aeskeyshare.html", gin.H{}) c.HTML(200, "aeskeyshare.html", gin.H{})
}) })

View File

@ -21,6 +21,26 @@ body {
} }
} }
.hidden {
display: none;
}
.iframe {
position: fixed;
right: 0;
top: 38px;
border: none;
height: 276px;
width: 400px;
transform: translateX(26px);
}
.acctbutton {
position: fixed;
right: 0;
margin: 0;
}
.spacer { .spacer {
margin-top: 30px; margin-top: 30px;
} }

37
templates/acct.html Normal file
View File

@ -0,0 +1,37 @@
<!DOCTYPE html>
<html lang="en"><head>
<link rel="stylesheet" href="/static/css/dashboard.css" media="">
<script src="/static/js/dashboard.js"></script>
<title>Dashboard</title>
</head>
<body>
<script>
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()
});
}
</script>
<div class="newoauth" style="margin: 0;">
<h2>Account settings</h2>
<p>Name: </p>
<p>Created: </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>

View File

@ -8,6 +8,7 @@
<body> <body>
<p class="credit">Image by perga (@pergagreen on discord)</p> <p class="credit">Image by perga (@pergagreen on discord)</p>
<img src="/static/img/background.jpg" class="background" alt=""> <img src="/static/img/background.jpg" class="background" alt="">
<div style="position: fixed;top: 0;"><button onclick="document.getElementById('iframe').classList.toggle('hidden');" class="acctbutton">Account</button><iframe id="iframe" src="/account" class="iframe hidden"></iframe></div>
<div class="newoauth"> <div class="newoauth">
<h2>Submit a new OAuth2 App</h2> <h2>Submit a new OAuth2 App</h2>
<p id="status"></p> <p id="status"></p>

View File

@ -69,6 +69,7 @@
<p id="passthrough" style="display: none;">{{ .name }}</p> <p id="passthrough" style="display: none;">{{ .name }}</p>
<p class="credit">Image by perga (@pergagreen on discord)</p> <p class="credit">Image by perga (@pergagreen on discord)</p>
<img src="/static/img/background.jpg" class="background" alt=""> <img src="/static/img/background.jpg" class="background" alt="">
<div style="position: fixed;top: 0;"><button onclick="document.getElementById('iframe').classList.toggle('hidden');" class="acctbutton">Account</button><iframe id="iframe" src="/account" class="iframe hidden"></iframe></div>
<div class="inoutdiv"> <div class="inoutdiv">
<h2 class="w300">Authorise Application</h2> <h2 class="w300">Authorise Application</h2>
<p id="statusBox">Loading...</p> <p id="statusBox">Loading...</p>