diff --git a/src/components/auth/user-auth-form.tsx b/src/components/auth/user-auth-form.tsx
index de3ad1d..2150ab9 100644
--- a/src/components/auth/user-auth-form.tsx
+++ b/src/components/auth/user-auth-form.tsx
@@ -53,7 +53,7 @@ export function UserAuthForm({
) : (
)}{" "}
- Q58论坛
+ Q58
);
diff --git a/src/components/auth/user-authorize.tsx b/src/components/auth/user-authorize.tsx
index ead469a..dd565c6 100644
--- a/src/components/auth/user-authorize.tsx
+++ b/src/components/auth/user-authorize.tsx
@@ -1,7 +1,9 @@
"use client";
import { useCallback, useEffect, useState } from "react";
+import { useRouter } from "next/navigation";
import { signIn } from "@/actions/user-authorize";
+import { useSession } from "next-auth/react";
interface UserAuthorizeProps extends React.HTMLAttributes {
data: Record;
@@ -14,6 +16,7 @@ export function UserAuthorize({
}: UserAuthorizeProps) {
const [isLoading, setIsLoading] = useState(false);
const [error, setError] = useState(null);
+ const { update } = useSession();
const signInCallback = useCallback(async () => {
if (isLoading) {
@@ -21,26 +24,15 @@ export function UserAuthorize({
}
setIsLoading(true);
try {
- // 检查是否有 OAuth 参数
- const searchParams = new URLSearchParams(data);
- const sso = searchParams.get("sso");
- const sig = searchParams.get("sig");
- const oauth = searchParams.get("oauth");
-
- let redirectTo = "/dashboard";
- if (sso && sig && oauth) {
- // 如果是从Q58论坛回调,使用原始的OAuth参数
- const oauthParams = new URLSearchParams(atob(oauth));
- redirectTo = `/oauth/authorize?${oauthParams.toString()}`;
- }
-
- await signIn({ ...data, redirectTo });
+ await signIn({ ...data, redirectTo: "/dashboard" });
+ // 更新 session
+ await update();
setIsLoading(false);
} catch (error) {
setError(error);
setIsLoading(false);
}
- }, [data, isLoading]);
+ }, [data, isLoading, update]);
useEffect(() => {
const timer = setTimeout(signInCallback, 5);