auth: SSOログイン後の画面遷移とユーザー表示を修正
- コールバック成功時のリダイレクト先をWEB_ORIGINルートから /dashboardに変更(ランディングで止まらないように) - ルートページでログイン済みならダッシュボードへ自動遷移 - サイドバーのユーザーカードをOIDC identityの表示名・メールに変更し、 未ログイン時のみSSOログインリンクを表示 - demoヘッダ(x-demo-user)はdemoモード時のみ送信
This commit is contained in:
+15
-1
@@ -1,10 +1,24 @@
|
||||
"use client";
|
||||
|
||||
import { useEffect } from "react";
|
||||
import Link from "next/link";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { ArrowRight, Boxes, FileArchive, Gauge, KeyRound, ShieldCheck, UploadCloud } from "lucide-react";
|
||||
import { AUTH_MODE, API_BASE } from "@/app/lib/dashboard";
|
||||
|
||||
export default function Home() {
|
||||
const router = useRouter();
|
||||
|
||||
// SSOモードでログイン済みなら、ランディングを挟まずダッシュボードへ向かう。
|
||||
useEffect(() => {
|
||||
if (AUTH_MODE !== "oidc") return;
|
||||
let cancelled = false;
|
||||
fetch(`${API_BASE}/api/v1/me`, { credentials: "include" })
|
||||
.then((response) => { if (response.ok && !cancelled) router.replace("/dashboard"); })
|
||||
.catch(() => {});
|
||||
return () => { cancelled = true; };
|
||||
}, [router]);
|
||||
|
||||
return <main className="landing">
|
||||
<header className="landing-header">
|
||||
<Link className="landing-brand" href="/"><span className="admin-brand-mark">A</span><span>AltDock</span><span className="landing-beta">BETA</span></Link>
|
||||
@@ -24,7 +38,7 @@ export default function Home() {
|
||||
<Link className="ui-button ui-button-primary" href="/dashboard">ダッシュボードを開く <ArrowRight size={15} /></Link>
|
||||
<a className="ui-button ui-button-outline" href="https://faq.altstore.io/developers/distribute-with-altstore-pal" target="_blank" rel="noreferrer">配布要件を見る</a>
|
||||
</div>
|
||||
<div className="landing-hero-meta"><Gauge size={14} />Demo mode で起動中 · API <code>{API_BASE}</code></div>
|
||||
{AUTH_MODE === "demo" && <div className="landing-hero-meta"><Gauge size={14} />Demo mode で起動中 · API <code>{API_BASE}</code></div>}
|
||||
</div>
|
||||
<aside className="landing-hero-card" aria-hidden="true">
|
||||
<div className="landing-flow-step"><span className="landing-flow-num">1</span><span><UploadCloud size={16} />ADP ZIPをアップロード</span></div>
|
||||
|
||||
Reference in New Issue
Block a user