clearer login and register errors

see #41
This commit is contained in:
Mystikfluu
2022-10-23 09:14:49 +02:00
parent 01f2888252
commit ea43f26954
4 changed files with 73 additions and 31 deletions
+20
View File
@@ -0,0 +1,20 @@
async function login() {
let r = (await post("/login",{
user: document.getElementById("user").value,
pass: document.getElementById("pass").value
}))
if(!r.url.endsWith("/user")) {
document.getElementById("pass").value = ""
console.error("login failed")
alert("Login failed, please make sure you have the right password")
return;
}
window.location = "/user"
}
let passfield = document.getElementById("pass")
function passkeydown(e) {
if(e.code == "Enter") {
login()
}
}