add logout button to user page

This commit is contained in:
Mystikfluu
2022-06-16 16:03:26 +02:00
parent 824eb99851
commit b41d420ce1
3 changed files with 13 additions and 2 deletions
+5 -2
View File
@@ -701,6 +701,11 @@ router.get("/avatars/*", (request, response, next) => {
response.status(404).send("No avatar with that name found")
})
router.get("/logout",async function(req,res) {
res.cookie("AUTH_COOKIE","", { maxAge: 0, httpOnly: true, secure: DID_I_FINALLY_ADD_HTTPS })
res.redirect("/")
})
router.get("/*", (request, response, next) => {
if(!increaseUSERCall(request,response))return
let originalUrl = request.originalUrl.split("?").shift()
@@ -719,8 +724,6 @@ router.get("/*", (request, response, next) => {
response.status(404).send("No file with that name found")
})
router.post("/register",async function(req,res) {
for (let i = 0; i < 10; i++) { //don't want people spam registering
if(!increaseAPICall(req,res))return;