add an unauthorized page

This commit is contained in:
Mystikfluu
2022-11-30 22:44:31 +01:00
parent 77ae066e46
commit 3a15b47fb1
11 changed files with 80 additions and 18 deletions
+4 -3
View File
@@ -1,15 +1,16 @@
async function login() {
let r = (await post("/login",{
user: document.getElementById("user").value,
pass: document.getElementById("pass").value
pass: document.getElementById("pass").value,
r: REDIRECT_URL
}))
if(!r.url.endsWith("/user")) {
if(!r.url.endsWith("/user") && !r.url.endsWith(REDIRECT_URL)) {
document.getElementById("pass").value = ""
console.error("login failed")
alert("Login failed, please make sure you have the right password")
return;
}
window.location = "/user"
window.location = r.url
}
let passfield = document.getElementById("pass")