|
1 | 1 | import { apiFetch } from './api.js'; |
2 | 2 | import { renderAuth, renderResetPassword, renderProjects, renderDashboard, renderBoard, renderNotFound, stopBoardEvents } from './views/index.js'; |
3 | | -import { getAuthStatusChecked, getUser, getBootstrapAvailable, getAuthStatusAvailable, getBoard } from './state/selectors.js'; |
4 | | -import { setAuthStatusChecked, setAuthStatusAvailable, setUser, setBootstrapAvailable, setRoute, setTag, setSearch, setSlug, setProjectId, setBoard, resetUserScopedState, setTagColors, setOpenTodoSegment, hydrateDashboardTodoSortFromServer } from './state/mutations.js'; |
| 3 | +import { getAuthStatusChecked, getUser, getBootstrapAvailable, getAuthStatusAvailable, getBoard, getOidcEnabled, getLocalAuthEnabled } from './state/selectors.js'; |
| 4 | +import { setAuthStatusChecked, setAuthStatusAvailable, setUser, setBootstrapAvailable, setOidcEnabled, setLocalAuthEnabled, setRoute, setTag, setSearch, setSlug, setProjectId, setBoard, resetUserScopedState, setTagColors, setOpenTodoSegment, hydrateDashboardTodoSortFromServer } from './state/mutations.js'; |
5 | 5 | import { loadUserTheme } from './theme.js'; |
6 | 6 | let isRouting = false; |
7 | 7 | let rerouteRequested = false; |
@@ -73,6 +73,8 @@ async function routeOnce() { |
73 | 73 | } |
74 | 74 | setUser(newUser); |
75 | 75 | setBootstrapAvailable(!!(st && st.bootstrapAvailable)); |
| 76 | + setOidcEnabled(!!(st && st.oidcEnabled)); |
| 77 | + setLocalAuthEnabled(st && st.localAuthEnabled !== false); |
76 | 78 | // Load full profile (including avatar) when logged in; /api/auth/status omits image to keep it lean |
77 | 79 | if (newUser) { |
78 | 80 | try { |
@@ -152,7 +154,7 @@ async function routeOnce() { |
152 | 154 | if (getUser() == null && getAuthStatusChecked() && getAuthStatusAvailable()) { |
153 | 155 | if (r.name === "projects" || r.name === "dashboard" || r.name === "boardBySlug") { |
154 | 156 | console.log("Router: showing auth UI (not logged in)"); |
155 | | - renderAuth({ next: window.location.pathname + window.location.search, bootstrap: getBootstrapAvailable() }); |
| 157 | + renderAuth({ next: window.location.pathname + window.location.search, bootstrap: getBootstrapAvailable(), oidcEnabled: getOidcEnabled(), localAuthEnabled: getLocalAuthEnabled() }); |
156 | 158 | return; |
157 | 159 | } |
158 | 160 | } |
@@ -197,7 +199,7 @@ async function routeOnce() { |
197 | 199 | console.error("Router: error rendering board:", err); |
198 | 200 | if (err && err.status === 401) { |
199 | 201 | // Only show auth UI for 401s (entry points). Resource endpoints should generally return 404 when unauthenticated. |
200 | | - renderAuth({ next: window.location.pathname + window.location.search, bootstrap: false }); |
| 202 | + renderAuth({ next: window.location.pathname + window.location.search, bootstrap: false, oidcEnabled: getOidcEnabled(), localAuthEnabled: getLocalAuthEnabled() }); |
201 | 203 | return; |
202 | 204 | } |
203 | 205 | throw err; |
|
0 commit comments