summaryrefslogtreecommitdiff
path: root/components
diff options
context:
space:
mode:
authorjoonhoekim <26rote@gmail.com>2025-10-14 17:24:40 +0900
committerjoonhoekim <26rote@gmail.com>2025-10-14 17:24:40 +0900
commit6892880c16af3eb0027a77c9695b2fe462b4761e (patch)
treea650a131cf46af00048b10db873eea70dc7196cd /components
parentb61931f50ba63f9a91ac8eb01fd91aa6e2fb6119 (diff)
(김준회) S-GIPS 유저 로그인 SMS 송신 오류 개선 및 로깅 추가
Diffstat (limited to 'components')
-rw-r--r--components/login/login-form.tsx37
1 files changed, 29 insertions, 8 deletions
diff --git a/components/login/login-form.tsx b/components/login/login-form.tsx
index b0a0e574..2fdf7cce 100644
--- a/components/login/login-form.tsx
+++ b/components/login/login-form.tsx
@@ -21,6 +21,7 @@ import {
} from "@/components/ui/input-otp"
import { requestPasswordResetAction } from "@/lib/users/auth/partners-auth";
import Loading from "../common/loading/loading";
+import { debugLog, debugSuccess, debugProcess } from "@/lib/debug-utils";
type LoginMethod = 'username' | 'sgips';
@@ -208,14 +209,29 @@ export function LoginForm() {
const targetUserId = userIdParam || mfaUserId;
if (!targetUserId || mfaCountdown > 0) return;
+ debugLog('SMS 전송 시작', {
+ userIdParam,
+ mfaUserId,
+ targetUserId,
+ selectedOtpUser: selectedOtpUser ? {
+ userId: selectedOtpUser.userId,
+ email: selectedOtpUser.email,
+ phone: selectedOtpUser.phone,
+ name: selectedOtpUser.name
+ } : null
+ });
+
setIsSmsLoading(true);
try {
- const requestBody: any = { userId: targetUserId };
+ const requestBody: { userId: number; phone?: string; name?: string } = { userId: targetUserId };
// S-GIPS 사용자인 경우 추가 정보 포함
if (selectedOtpUser) {
requestBody.phone = selectedOtpUser.phone;
requestBody.name = selectedOtpUser.name;
+ debugSuccess('S-GIPS 사용자 정보 포함', { phone: selectedOtpUser.phone, name: selectedOtpUser.name });
+ } else {
+ debugLog('일반 사용자 (selectedOtpUser 없음)');
}
const response = await fetch('/api/auth/send-sms', {
@@ -453,6 +469,14 @@ export function LoginForm() {
// 선택된 OTP 사용자와 함께 MFA 진행
const proceedWithSelectedUser = async (user: OtpUser, tempAuthKey: string) => {
try {
+ debugProcess('선택된 S-GIPS 사용자로 MFA 진행', {
+ userId: user.userId,
+ email: user.email,
+ phone: user.phone,
+ name: user.name,
+ tempAuthKey
+ });
+
// 사용자 정보를 기반으로 MFA 진행
setTempAuthKey(tempAuthKey);
setSelectedOtpUser(user);
@@ -460,14 +484,11 @@ export function LoginForm() {
setMfaUserEmail(user.email);
setShowMfaForm(true);
- // 선택된 사용자의 정보를 이용해 SMS 전송 준비
- // 실제로는 userId가 필요하므로 API에서 받아와야 함
- // 여기서는 임시로 user 객체를 저장하고 SMS 전송 시 사용
+ // 선택된 사용자의 userId를 직접 전달하여 SMS 전송
setTimeout(() => {
- // 실제 구현에서는 user 정보를 기반으로 SMS 전송
- // 현재는 기존 로직 유지하되, 선택된 사용자 정보 활용
- handleSendSms();
- }, 500);
+ debugLog('SMS 전송 타이머 실행 (2000ms 후)', { userId: user.userId });
+ handleSendSms(user.userId);
+ }, 2000);
toast({
title: t('sgipsAuthComplete'),