fix(ui): redirect to login when auth check fails from remote access

When the auth check API call fails (e.g., 403 from the localhost
security middleware), the catch block assumed no auth was needed and
marked the user as authenticated. This caused a silently broken
dashboard with no providers and no error feedback.

Now treats auth check failure as auth-required, redirecting to the
login page where users get a clear prompt to configure credentials.
This commit is contained in:
Tam Nhu Tran
2026-03-28 21:22:20 -04:00
parent efe6953da0
commit e9fceed807
+4 -3
View File
@@ -47,9 +47,10 @@ export function AuthProvider({ children }: { children: ReactNode }) {
setUsername(res.username);
})
.catch(() => {
// If check fails, assume no auth required (backward compat)
setAuthRequired(false);
setIsAuthenticated(true);
// If auth check fails (e.g., 403 from remote access without auth configured),
// treat as auth required so the login page appears instead of a broken dashboard.
setAuthRequired(true);
setIsAuthenticated(false);
})
.finally(() => setLoading(false));
}, []);