From ef4c533ebacc2cdc97e518f30e9a9350004fcdfb Mon Sep 17 00:00:00 2001 From: dujinkim Date: Mon, 28 Apr 2025 02:13:30 +0000 Subject: ~20250428 작업사항 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/login/login-form-shi.tsx | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) (limited to 'components/login/login-form-shi.tsx') diff --git a/components/login/login-form-shi.tsx b/components/login/login-form-shi.tsx index fb985592..ef39d122 100644 --- a/components/login/login-form-shi.tsx +++ b/components/login/login-form-shi.tsx @@ -110,8 +110,25 @@ export function LoginFormSHI({ title: t('loginSuccess'), description: t('youAreLoggedIn'), }); - - router.push(`/${lng}/evcp/report`); + + const callbackUrlParam = searchParams?.get('callbackUrl'); + + if (callbackUrlParam) { + try { + // URL 객체로 파싱 + const callbackUrl = new URL(callbackUrlParam); + + // pathname + search만 사용 (호스트 제거) + const relativeUrl = callbackUrl.pathname + callbackUrl.search; + router.push(relativeUrl); + } catch (e) { + // 유효하지 않은 URL이면 그대로 사용 (이미 상대 경로일 수 있음) + router.push(callbackUrlParam); + } + } else { + // callbackUrl이 없으면 기본 대시보드로 리다이렉트 + router.push(`/${lng}/evcp/report`); + } } else { toast({ @@ -186,8 +203,10 @@ export function LoginFormSHI({
{/* Here's your existing login/OTP forms: */} - {!otpSent ? ( -
+ {/* {!otpSent ? + ( */} + {/* */} +

{t('loginMessage')}

@@ -232,7 +251,10 @@ export function LoginFormSHI({
- ) : ( + {/* ) + + + : (
@@ -283,7 +305,7 @@ export function LoginFormSHI({
- )} + )} */}
{t('termsMessage')} {t('termsOfService')} {t('and')} -- cgit v1.2.3