diff --git a/src/app/login/page.tsx b/src/app/login/page.tsx index 1fb174b..9be5f19 100644 --- a/src/app/login/page.tsx +++ b/src/app/login/page.tsx @@ -248,7 +248,7 @@ function LoginPageClient() { } const redirect = searchParams.get('redirect') || '/'; - router.replace(redirect); + window.location.replace(redirect); } else { // 登录失败,重置Turnstile if (siteConfig?.LoginRequireTurnstile && turnstileWidgetId !== null && (window as any).turnstile) { diff --git a/src/app/oidc-register/page.tsx b/src/app/oidc-register/page.tsx index 45088db..a1252dd 100644 --- a/src/app/oidc-register/page.tsx +++ b/src/app/oidc-register/page.tsx @@ -56,8 +56,8 @@ function OIDCRegisterPageClient() { }); if (res.ok) { - // 注册成功,跳转到首页 - router.replace('/'); + // 注册成功,接口已写入认证 cookie,这里用整页跳转确保权限配置和登录态完全重建 + window.location.replace('/'); } else { const data = await res.json().catch(() => ({})); setError(data.error || '注册失败');