feat(auth): add configurable password login with SSO default
ci/woodpecker/push/woodpecker Pipeline was successful

Co-authored-by: HiFox Agent <agents-noreply@hifox.com>
This commit is contained in:
kfluous
2026-09-05 18:22:41 +08:00
co-authored by HiFox Agent
parent 4430fb75f1
commit 0dc7e89c1d
12 changed files with 244 additions and 15 deletions
+3 -1
View File
@@ -3,6 +3,7 @@ import { Shell } from "./components/Shell";
import AuthProvider from "./auth/AuthProvider";
import { useAuth } from "./auth/useAuth";
import UnauthorizedPage from "./auth/UnauthorizedPage";
import PasswordLogin from "./auth/PasswordLogin";
import { canAccessEnergy } from "./shared/auth/roles";
import { LoadingState, SkeletonBlock, SurfaceCard } from "./components/ui/surface";
import { buildModules } from "./app/modules";
@@ -22,7 +23,7 @@ const HydrogenPrototypeBoard = lazy(
normalizeBrowserPath();
function AuthGate() {
const { isLoading, isAuthenticated, error, user } = useAuth();
const { isLoading, isAuthenticated, error, user, mode } = useAuth();
const [route, setRoute] = useState(readBrowserRoute);
const { routeKey, pathSet } = route;
@@ -71,6 +72,7 @@ function AuthGate() {
}
if (!isAuthenticated) {
if (mode === 'password') return <PasswordLogin />;
return <UnauthorizedPage message={error || undefined} />;
}