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 = "/";
}
}
+5 -3
View File
@@ -155,8 +155,8 @@
</div>
</div>
<form id="password-form" class="space-y-3">
<p class="text-xs font-semibold uppercase tracking-wider text-slate-500">Change Password</p>
<form id="password-form" class="space-y-3 mt-2 pt-4 border-t border-slate-800">
<p class="text-xs font-semibold uppercase tracking-wider text-slate-500 pb-1">Change Password</p>
<input
id="current-password"
type="password"
@@ -183,7 +183,9 @@
class="w-full px-3 py-2 rounded-lg bg-slate-900 border border-slate-700 focus:outline-none focus:ring-2 focus:ring-sky-500"
required
/>
<p id="password-policy-hint" class="text-xs text-slate-400"></p>
<div class="pt-1">
<p id="password-policy-hint" class="text-xs text-slate-400 mb-3"></p>
</div>
<button
type="submit"
class="inline-flex items-center gap-2 px-4 py-2 rounded-lg bg-sky-600 hover:bg-sky-500 transition-colors text-white text-sm font-medium"