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) { if (!res.ok) {
window.location.href = "/login.html"; window.location.href = "/";
return; return;
} }
@@ -888,7 +888,7 @@ async function init() {
await loadSavedBuilds(); await loadSavedBuilds();
} catch (err) { } catch (err) {
console.error("Failed to fetch user info:", 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 { try {
const res = await fetch("/api/auth/me"); const res = await fetch("/api/auth/me");
if (!res.ok) { if (!res.ok) {
window.location.href = "/login.html"; window.location.href = "/";
return; return;
} }
@@ -110,7 +110,7 @@ async function checkAuth() {
} }
} catch (err) { } catch (err) {
console.error("Auth check failed:", 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" }); const res = await fetch(`/api/auth/feature-check?${params}`, { credentials: "include" });
if (res.status === 401) { if (res.status === 401) {
window.location.href = "/login.html"; window.location.href = "/";
return false; return false;
} }
+1 -1
View File
@@ -302,7 +302,7 @@ async function loadCurrentUser() {
initializeRenderer(); initializeRenderer();
} else { } else {
window.location.href = "/login.html"; window.location.href = "/";
} }
} catch (err) { } catch (err) {
console.error("Failed to load user:", err); console.error("Failed to load user:", err);
+3 -3
View File
@@ -480,7 +480,7 @@ async function fetchMetrics() {
}); });
if (response.status === 401) { if (response.status === 401) {
window.location.href = "/login.html"; window.location.href = "/";
return; return;
} }
@@ -503,7 +503,7 @@ async function checkAuth() {
try { try {
const res = await fetch("/api/auth/me", { credentials: "include" }); const res = await fetch("/api/auth/me", { credentials: "include" });
if (!res.ok) { if (!res.ok) {
window.location.href = "/login.html"; window.location.href = "/";
return; return;
} }
@@ -559,7 +559,7 @@ async function checkAuth() {
} }
} catch (err) { } catch (err) {
console.error("Auth check failed:", 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 { try {
const res = await fetch("/api/auth/me", { credentials: "include" }); const res = await fetch("/api/auth/me", { credentials: "include" });
if (!res.ok) { if (!res.ok) {
window.location.href = "/login.html"; window.location.href = "/";
return; return;
} }
@@ -69,7 +69,7 @@ async function checkAuth() {
} }
} catch (err) { } catch (err) {
console.error("Auth check failed:", 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 { try {
const res = await fetch("/api/auth/me"); const res = await fetch("/api/auth/me");
if (!res.ok) { if (!res.ok) {
window.location.href = "/login.html"; window.location.href = "/";
return; return;
} }
@@ -123,7 +123,7 @@ async function checkAuth() {
} }
} catch (err) { } catch (err) {
console.error("Auth check failed:", 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() { async function loadCurrentUser() {
const res = await fetch("/api/auth/me", { credentials: "include" }); const res = await fetch("/api/auth/me", { credentials: "include" });
if (!res.ok) { if (!res.ok) {
window.location.href = "/login.html"; window.location.href = "/";
return; return;
} }
@@ -960,7 +960,7 @@ async function handleRevokeSessionClick(event) {
} }
if (isCurrent) { if (isCurrent) {
window.location.href = "/login.html"; window.location.href = "/";
return; return;
} }
@@ -146,7 +146,7 @@ function renderClients() {
async function loadCurrentUser() { async function loadCurrentUser() {
const res = await fetch("/api/auth/me", { credentials: "include" }); const res = await fetch("/api/auth/me", { credentials: "include" });
if (!res.ok) { if (!res.ok) {
window.location.href = "/login.html"; window.location.href = "/";
return; return;
} }
state.me = await res.json(); state.me = await res.json();
+2 -2
View File
@@ -77,11 +77,11 @@ async function getCurrentUser() {
window.location.href = "/"; window.location.href = "/";
} }
} else { } else {
window.location.href = "/login.html"; window.location.href = "/";
} }
} catch (err) { } catch (err) {
console.error("Failed to get current user:", 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 { try {
const res = await fetch("/api/auth/me"); const res = await fetch("/api/auth/me");
if (!res.ok) { if (!res.ok) {
window.location.href = "/login.html"; window.location.href = "/";
return; return;
} }
@@ -83,7 +83,7 @@ async function checkAuth() {
} }
} catch (err) { } catch (err) {
console.error("Auth check failed:", 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>
</div> </div>
<form id="password-form" class="space-y-3"> <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">Change Password</p> <p class="text-xs font-semibold uppercase tracking-wider text-slate-500 pb-1">Change Password</p>
<input <input
id="current-password" id="current-password"
type="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" 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 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 <button
type="submit" 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" 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"