From df1cdd33046599635b55f3d7e56b9a9930488e5f Mon Sep 17 00:00:00 2001 From: jisangs Date: Sun, 5 Jul 2026 11:46:21 +0900 Subject: [PATCH] =?UTF-8?q?=EB=A1=9C=EA=B7=B8=EC=9D=B8=20=ED=9B=84=20?= =?UTF-8?q?=EB=A6=AC=EB=8B=A4=EC=9D=B4=EB=A0=89=ED=8A=B8=EB=A5=BC=20?= =?UTF-8?q?=EA=B2=80=EC=A6=9D=EB=90=9C=20=EC=83=81=EB=8C=80=EA=B2=BD?= =?UTF-8?q?=EB=A1=9C=EB=A1=9C=20=EA=B3=A0=EC=A0=95,=20NextAuth=20=EA=B3=84?= =?UTF-8?q?=EC=82=B0=20URL=EC=9D=80=20=EB=A1=9C=EA=B7=B8=EB=A1=9C=20?= =?UTF-8?q?=EA=B8=B0=EB=A1=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/(auth)/login/actions.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/app/(auth)/login/actions.ts b/app/(auth)/login/actions.ts index 191391f..5fb5023 100644 --- a/app/(auth)/login/actions.ts +++ b/app/(auth)/login/actions.ts @@ -4,6 +4,7 @@ import { AuthError } from "next-auth"; import { redirect } from "next/navigation"; import { signIn } from "@/auth"; +import { logger } from "@/lib/logger"; function sanitizeCallbackUrl(raw: string): string { try { @@ -21,11 +22,17 @@ export async function loginAction(formData: FormData) { ); try { - await signIn("credentials", { + const nextAuthRedirectUrl = await signIn("credentials", { adminName: formData.get("adminName"), password: formData.get("password"), + redirect: false, redirectTo: callbackUrl, }); + + logger.info("auth", "login redirect", { + nextAuthRedirectUrl: String(nextAuthRedirectUrl), + callbackUrl, + }); } catch (error) { if (error instanceof AuthError) { redirect( @@ -35,4 +42,6 @@ export async function loginAction(formData: FormData) { throw error; } + + redirect(callbackUrl); }