Updated login.js

This commit is contained in:
Tracker-Friendly 2024-02-25 18:27:35 +00:00
parent aa35c8f7b4
commit 3d252af12e
1 changed files with 3 additions and 3 deletions

View File

@ -127,6 +127,7 @@ signupButton.addEventListener("click", (event) => {
window.location.href = "/app" window.location.href = "/app"
} }
else if (response.status == 401) { else if (response.status == 401) {
console.log("Trying oldhash")
fetch("/api/login", { fetch("/api/login", {
method: "POST", method: "POST",
body: JSON.stringify({ body: JSON.stringify({
@ -139,7 +140,7 @@ signupButton.addEventListener("click", (event) => {
}) })
.then((response) => response) .then((response) => response)
.then((response) => { .then((response) => {
async function doStuff() { async function doStuff2() {
let responseData = await response.json() let responseData = await response.json()
if (response.status == 200) { if (response.status == 200) {
localStorage.setItem("DONOTSHARE-secretkey", responseData["key"]) localStorage.setItem("DONOTSHARE-secretkey", responseData["key"])
@ -148,7 +149,6 @@ signupButton.addEventListener("click", (event) => {
window.location.href = "/app" window.location.href = "/app"
} }
else if (response.status == 401) { else if (response.status == 401) {
statusBox.innerText = "Wrong username or password..." statusBox.innerText = "Wrong username or password..."
showInput(1) showInput(1)
showElements(true) showElements(true)
@ -159,7 +159,7 @@ signupButton.addEventListener("click", (event) => {
showElements(true) showElements(true)
} }
} }
doStuff() doStuff2()
}); });
} }
else { else {