fix logins page redirect
This commit is contained in:
@@ -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 = "/";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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 = "/";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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 = "/";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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 = "/";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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 = "/";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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 = "/";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user