diff --git a/app/auth/callback/route.ts b/app/auth/callback/route.ts index 7873e82..a214264 100644 --- a/app/auth/callback/route.ts +++ b/app/auth/callback/route.ts @@ -65,20 +65,14 @@ export async function GET(request: NextRequest) { // code 교환으로 세션이 생성된 상태입니다. // ---------------------------------------------------------------------- - const { - data: { user }, - } = await supabase.auth.getUser(); - - // 회원가입 직후 인증 여부 확인 (생성된 지 1분 이내) - // 별도의 type 파라미터 없이 데이터 기반으로 판단합니다. - const isNewUser = - user && - user.created_at && - new Date(user.created_at).getTime() > Date.now() - 60 * 1000; // 1분 이내 생성 + // 회원가입 인증 여부 확인 (쿼리 파라미터 기반) + // actions.ts의 signup 함수에서 emailRedirectTo에 auth_type=signup을 추가해서 보냅니다. + const authType = requestUrl.searchParams.get("auth_type"); + const isSignupVerification = authType === "signup"; // 회원가입 인증인 경우: // 이메일 인증만 완료하고, 자동 로그인된 세션은 종료시킨 뒤 로그인 페이지로 보냅니다. - if (isNewUser) { + if (isSignupVerification) { await supabase.auth.signOut(); return NextResponse.redirect( `${origin}${AUTH_ROUTES.LOGIN}?message=${encodeURIComponent( diff --git a/app/forgot-password/page.tsx b/app/forgot-password/page.tsx index e439111..0c561f5 100644 --- a/app/forgot-password/page.tsx +++ b/app/forgot-password/page.tsx @@ -27,9 +27,9 @@ export default async function ForgotPasswordPage({ const { message } = await searchParams; return ( -