fix logins page redirect

This commit is contained in:
KingKDot
2026-04-13 20:26:03 -05:00
parent 41f8f087ce
commit 30e5d4d67b
12 changed files with 25 additions and 23 deletions
+2 -2
View File
@@ -824,7 +824,7 @@ async function init() {
});
if (!res.ok) {
window.location.href = "/login.html";
window.location.href = "/";
return;
}
@@ -888,7 +888,7 @@ async function init() {
await loadSavedBuilds();
} catch (err) {
console.error("Failed to fetch user info:", err);
window.location.href = "/login.html";
window.location.href = "/";
}
}
+2 -2
View File
@@ -56,7 +56,7 @@ async function checkAuth() {
try {
const res = await fetch("/api/auth/me");
if (!res.ok) {
window.location.href = "/login.html";
window.location.href = "/";
return;
}
@@ -110,7 +110,7 @@ async function checkAuth() {
}
} catch (err) {
console.error("Auth check failed:", err);
window.location.href = "/login.html";
window.location.href = "/";
}
}
@@ -14,7 +14,7 @@ export async function checkFeatureAccess(feature, clientId) {
const res = await fetch(`/api/auth/feature-check?${params}`, { credentials: "include" });
if (res.status === 401) {
window.location.href = "/login.html";
window.location.href = "/";
return false;
}
+1 -1
View File
@@ -302,7 +302,7 @@ async function loadCurrentUser() {
initializeRenderer();
} else {
window.location.href = "/login.html";
window.location.href = "/";
}
} catch (err) {
console.error("Failed to load user:", err);
+3 -3
View File
@@ -480,7 +480,7 @@ async function fetchMetrics() {
});
if (response.status === 401) {
window.location.href = "/login.html";
window.location.href = "/";
return;
}
@@ -503,7 +503,7 @@ async function checkAuth() {
try {
const res = await fetch("/api/auth/me", { credentials: "include" });
if (!res.ok) {
window.location.href = "/login.html";
window.location.href = "/";
return;
}
@@ -559,7 +559,7 @@ async function checkAuth() {
}
} catch (err) {
console.error("Auth check failed:", err);
window.location.href = "/login.html";
window.location.href = "/";
}
}
+2 -2
View File
@@ -8,7 +8,7 @@ async function checkAuth() {
try {
const res = await fetch("/api/auth/me", { credentials: "include" });
if (!res.ok) {
window.location.href = "/login.html";
window.location.href = "/";
return;
}
@@ -69,7 +69,7 @@ async function checkAuth() {
}
} catch (err) {
console.error("Auth check failed:", err);
window.location.href = "/login.html";
window.location.href = "/";
}
}
+2 -2
View File
@@ -58,7 +58,7 @@ async function checkAuth() {
try {
const res = await fetch("/api/auth/me");
if (!res.ok) {
window.location.href = "/login.html";
window.location.href = "/";
return;
}
@@ -123,7 +123,7 @@ async function checkAuth() {
}
} catch (err) {
console.error("Auth check failed:", err);
window.location.href = "/login.html";
window.location.href = "/";
}
}
+2 -2
View File
@@ -307,7 +307,7 @@ function loadPrefs() {
async function loadCurrentUser() {
const res = await fetch("/api/auth/me", { credentials: "include" });
if (!res.ok) {
window.location.href = "/login.html";
window.location.href = "/";
return;
}
@@ -960,7 +960,7 @@ async function handleRevokeSessionClick(event) {
}
if (isCurrent) {
window.location.href = "/login.html";
window.location.href = "/";
return;
}
@@ -146,7 +146,7 @@ function renderClients() {
async function loadCurrentUser() {
const res = await fetch("/api/auth/me", { credentials: "include" });
if (!res.ok) {
window.location.href = "/login.html";
window.location.href = "/";
return;
}
state.me = await res.json();
+2 -2
View File
@@ -77,11 +77,11 @@ async function getCurrentUser() {
window.location.href = "/";
}
} else {
window.location.href = "/login.html";
window.location.href = "/";
}
} catch (err) {
console.error("Failed to get current user:", err);
window.location.href = "/login.html";
window.location.href = "/";
}
}
+2 -2
View File
@@ -50,7 +50,7 @@ async function checkAuth() {
try {
const res = await fetch("/api/auth/me");
if (!res.ok) {
window.location.href = "/login.html";
window.location.href = "/";
return;
}
@@ -83,7 +83,7 @@ async function checkAuth() {
}
} catch (err) {
console.error("Auth check failed:", err);
window.location.href = "/login.html";
window.location.href = "/";
}
}