From 8c916739d0116e9e53e4f209ebb5b14596871453 Mon Sep 17 00:00:00 2001
From: dujinkim <dujin.kim@dtsolution.co.kr>
Date: Fri, 15 Aug 2025 05:20:10 +0000
Subject: (대표님) 파트너 로그인 i18n 처리
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 components/login/login-form.tsx | 114 ++++++++++++++++++++--------------------
 1 file changed, 56 insertions(+), 58 deletions(-)

(limited to 'components/login/login-form.tsx')

diff --git a/components/login/login-form.tsx b/components/login/login-form.tsx
index b850a3d3..f8ba21d9 100644
--- a/components/login/login-form.tsx
+++ b/components/login/login-form.tsx
@@ -91,7 +91,7 @@ export function LoginForm({
     useEffect(() => {
         if (passwordResetState.success && passwordResetState.message) {
             toast({
-                title: '재설정 링크 전송',
+                title: t('resetLinkSent'),
                 description: passwordResetState.message,
             });
             setShowForgotPassword(false);
@@ -120,7 +120,7 @@ export function LoginForm({
             const result = await response.json();
 
             if (!response.ok) {
-                throw new Error(result.error || '인증에 실패했습니다.');
+                throw new Error(result.error || t('authenticationFailed'));
             }
 
             return result;
@@ -146,14 +146,14 @@ export function LoginForm({
             if (response.ok) {
                 setMfaCountdown(60);
                 toast({
-                    title: 'SMS 전송 완료',
-                    description: '인증번호를 전송했습니다.',
+                    title: t('smsSent'),
+                    description: t('smsCodeSent'),
                 });
             } else {
                 const errorData = await response.json();
                 toast({
                     title: t('errorTitle'),
-                    description: errorData.message || 'SMS 전송에 실패했습니다.',
+                    description: errorData.message || t('smsFailure'),
                     variant: 'destructive',
                 });
             }
@@ -161,7 +161,7 @@ export function LoginForm({
             console.error('SMS send error:', error);
             toast({
                 title: t('errorTitle'),
-                description: 'SMS 전송 중 오류가 발생했습니다.',
+                description: t('smsError'),
                 variant: 'destructive',
             });
         } finally {
@@ -176,7 +176,7 @@ export function LoginForm({
         if (!mfaToken || mfaToken.length !== 6) {
             toast({
                 title: t('errorTitle'),
-                description: '6자리 인증번호를 입력해주세요.',
+                description: t('enterSixDigitCode'),
                 variant: 'destructive',
             });
             return;
@@ -185,7 +185,7 @@ export function LoginForm({
         if (!tempAuthKey) {
             toast({
                 title: t('errorTitle'),
-                description: '인증 세션이 만료되었습니다. 다시 로그인해주세요.',
+                description: t('authSessionExpired'),
                 variant: 'destructive',
             });
             setShowMfaForm(false);
@@ -205,8 +205,8 @@ export function LoginForm({
 
             if (result?.ok) {
                 toast({
-                    title: '인증 완료',
-                    description: '로그인이 완료되었습니다.',
+                    title: t('authenticationComplete'),
+                    description: t('loginCompleted'),
                 });
 
                 // 콜백 URL 처리
@@ -223,18 +223,18 @@ export function LoginForm({
                     router.push(`/${lng}/partners/dashboard`);
                 }
             } else {
-                let errorMessage = '인증번호가 올바르지 않습니다.';
+                let errorMessage = t('invalidAuthCode');
                 
                 if (result?.error) {
                     switch (result.error) {
                         case 'CredentialsSignin':
-                            errorMessage = '인증번호가 올바르지 않거나 만료되었습니다.';
+                            errorMessage = t('authCodeExpired');
                             break;
                         case 'AccessDenied':
-                            errorMessage = '접근이 거부되었습니다.';
+                            errorMessage = t('accessDenied');
                             break;
                         default:
-                            errorMessage = 'MFA 인증에 실패했습니다.';
+                            errorMessage = t('mfaAuthFailed');
                     }
                 }
 
@@ -248,7 +248,7 @@ export function LoginForm({
             console.error('MFA verification error:', error);
             toast({
                 title: t('errorTitle'),
-                description: 'MFA 인증 중 오류가 발생했습니다.',
+                description: t('mfaAuthError'),
                 variant: 'destructive',
             });
         } finally {
@@ -277,8 +277,8 @@ export function LoginForm({
 
             if (authResult.success) {
                 toast({
-                    title: '1차 인증 완료',
-                    description: 'SMS 인증을 진행합니다.',
+                    title: t('firstAuthComplete'),
+                    description: t('proceedingSmsAuth'),
                 });
 
                 // MFA 화면으로 전환
@@ -293,8 +293,8 @@ export function LoginForm({
                 }, 500);
 
                 toast({
-                    title: 'SMS 인증 필요',
-                    description: '등록된 전화번호로 인증번호를 전송합니다.',
+                    title: t('smsAuthRequired'),
+                    description: t('sendingCodeToPhone'),
                 });
             }
         } catch (error: any) {
@@ -336,8 +336,8 @@ export function LoginForm({
 
             if (authResult.success) {
                 toast({
-                    title: 'S-Gips 인증 완료',
-                    description: 'SMS 인증을 진행합니다.',
+                    title: t('sgipsAuthComplete'),
+                    description: t('proceedingSmsAuth'),
                 });
 
                 // MFA 화면으로 전환
@@ -352,8 +352,8 @@ export function LoginForm({
                 }, 500);
 
                 toast({
-                    title: 'SMS 인증 시작',
-                    description: 'S-Gips 등록 전화번호로 인증번호를 전송합니다.',
+                    title: t('smsAuthStarted'),
+                    description: t('sendingCodeToSgipsPhone'),
                 });
             }
         } catch (error: any) {
@@ -399,7 +399,7 @@ export function LoginForm({
                         className={cn(buttonVariants({ variant: "ghost" }))}
                     >
                         <InfoIcon className="w-4 h-4 mr-1" />
-                        {'업체 등록 신청'}
+                        {t('registerVendor')}
                     </Link>
                 </div>
 
@@ -414,7 +414,7 @@ export function LoginForm({
                                         <>
                                             <h1 className="text-2xl font-bold">{t('loginMessage')}</h1>
                                             <p className="text-xs text-muted-foreground mt-2">
-                                                {'등록된 업체만 로그인하실 수 있습니다. 아직 등록되지 않은 업체라면 상단의 업체 등록 신청 버튼을 이용해주세요.'}
+                                                {t('loginDescription')}
                                             </p>
                                         </>
                                     ) : (
@@ -422,12 +422,12 @@ export function LoginForm({
                                             <div className="flex items-center justify-center w-12 h-12 rounded-full bg-blue-100 mb-4">
                                                 🔐
                                             </div>
-                                            <h1 className="text-2xl font-bold">SMS 인증</h1>
+                                            <h1 className="text-2xl font-bold">{t('smsVerification')}</h1>
                                             <p className="text-sm text-muted-foreground mt-2">
-                                                {mfaUserEmail}로 1차 인증이 완료되었습니다
+                                                {t('firstAuthCompleteFor', { email: mfaUserEmail })}
                                             </p>
                                             <p className="text-xs text-muted-foreground mt-1">
-                                                등록된 전화번호로 전송된 6자리 인증번호를 입력해주세요
+                                                {t('enterSixDigitCodeInstructions')}
                                             </p>
                                         </>
                                     )}
@@ -448,7 +448,7 @@ export function LoginForm({
                                                         : "text-muted-foreground hover:text-foreground"
                                                 )}
                                             >
-                                                일반 로그인
+                                                {t('generalLogin')}
                                             </button>
                                             <button
                                                 type="button"
@@ -460,7 +460,7 @@ export function LoginForm({
                                                         : "text-muted-foreground hover:text-foreground"
                                                 )}
                                             >
-                                                S-Gips 로그인
+                                                {t('sgipsLogin')}
                                             </button>
                                         </div>
 
@@ -471,7 +471,7 @@ export function LoginForm({
                                                     <Input
                                                         id="username"
                                                         type="text"
-                                                        placeholder="이메일을 넣으세요"
+                                                        placeholder={t('emailPlaceholder')}
                                                         required
                                                         className="h-10"
                                                         value={username}
@@ -497,7 +497,7 @@ export function LoginForm({
                                                     variant="samsung"
                                                     disabled={isFirstAuthLoading || !username || !password}
                                                 >
-                                                    {isFirstAuthLoading ? '인증 중...' : t('login')}
+                                                    {isFirstAuthLoading ? t('authenticating') : t('login')}
                                                 </Button>
                                             </form>
                                         )}
@@ -509,7 +509,7 @@ export function LoginForm({
                                                     <Input
                                                         id="sgipsUsername"
                                                         type="text"
-                                                        placeholder="S-Gips ID"
+                                                        placeholder={t('sgipsId')}
                                                         required
                                                         className="h-10"
                                                         value={sgipsUsername}
@@ -521,7 +521,7 @@ export function LoginForm({
                                                     <Input
                                                         id="sgipsPassword"
                                                         type="password"
-                                                        placeholder="S-Gips 비밀번호"
+                                                        placeholder={t('sgipsPassword')}
                                                         required
                                                         className="h-10"
                                                         value={sgipsPassword}
@@ -535,10 +535,10 @@ export function LoginForm({
                                                     variant="default"
                                                     disabled={isFirstAuthLoading || !sgipsUsername || !sgipsPassword}
                                                 >
-                                                    {isFirstAuthLoading ? 'S-Gips 인증 중...' : 'S-Gips 로그인'}
+                                                    {isFirstAuthLoading ? t('sgipsAuthenticating') : t('sgipsLogin')}
                                                 </Button>
                                                 <p className="text-xs text-muted-foreground text-center">
-                                                    S-Gips 계정으로 로그인하면 자동으로 SMS 인증이 진행됩니다.
+                                                    {t('sgipsAutoSms')}
                                                 </p>
                                             </form>
                                         )}
@@ -551,7 +551,7 @@ export function LoginForm({
                                                 className="text-blue-600 hover:text-blue-800 text-sm"
                                                 onClick={goToVendorRegistration}
                                             >
-                                                {'신규 업체이신가요? 여기서 등록하세요'}
+                                                {t('newVendor')}
                                             </Button>
 
                                             {loginMethod === 'username' && (
@@ -561,7 +561,7 @@ export function LoginForm({
                                                     className="text-blue-600 hover:text-blue-800 text-sm"
                                                     onClick={() => setShowForgotPassword(true)}
                                                 >
-                                                    비밀번호를 잊으셨나요?
+                                                    {t('forgotPassword')}
                                                 </Button>
                                             )}
                                         </div>
@@ -579,17 +579,17 @@ export function LoginForm({
                                                 className="text-blue-600 hover:text-blue-800"
                                             >
                                                 <ArrowLeft className="w-4 h-4 mr-1" />
-                                                다시 로그인하기
+                                                {t('backToLogin')}
                                             </Button>
                                         </div>
 
                                         {/* SMS 재전송 섹션 */}
                                         <div className="bg-gray-50 p-4 rounded-lg">
                                             <h3 className="text-sm font-medium text-gray-900 mb-2">
-                                                인증번호 재전송
+                                                {t('resendCode')}
                                             </h3>
                                             <p className="text-xs text-gray-600 mb-3">
-                                                인증번호를 받지 못하셨나요?
+                                                {t('didNotReceiveCode')}
                                             </p>
                                             <Button
                                                 onClick={() => handleSendSms()}
@@ -600,11 +600,11 @@ export function LoginForm({
                                                 type="button"
                                             >
                                                 {isSmsLoading ? (
-                                                    '전송 중...'
+                                                    t('sending')
                                                 ) : mfaCountdown > 0 ? (
-                                                    `재전송 가능 (${mfaCountdown}초)`
+                                                    t('resendAvailable', { seconds: mfaCountdown })
                                                 ) : (
-                                                    '인증번호 재전송'
+                                                    t('resendCode')
                                                 )}
                                             </Button>
                                         </div>
@@ -614,7 +614,7 @@ export function LoginForm({
                                             <div className="space-y-4">
                                                 <div className="text-center">
                                                     <label className="block text-sm font-medium text-gray-700 mb-3">
-                                                        6자리 인증번호를 입력해주세요
+                                                        {t('enterSixDigitCode')}
                                                     </label>
                                                     <div className="flex justify-center">
                                                         <InputOTP
@@ -641,7 +641,7 @@ export function LoginForm({
                                                 variant="samsung"
                                                 disabled={isMfaLoading || mfaToken.length !== 6}
                                             >
-                                                {isMfaLoading ? '인증 중...' : '인증 완료'}
+                                                {isMfaLoading ? t('authenticating') : t('authenticationComplete')}
                                             </Button>
                                         </form>
 
@@ -653,13 +653,13 @@ export function LoginForm({
                                                 </div>
                                                 <div className="ml-2">
                                                     <h4 className="text-xs font-medium text-yellow-800">
-                                                        인증번호를 받지 못하셨나요?
+                                                        {t('didNotReceiveCode')}
                                                     </h4>
                                                     <div className="mt-1 text-xs text-yellow-700">
                                                         <ul className="list-disc list-inside space-y-1">
-                                                            <li>전화번호가 올바른지 확인해주세요</li>
-                                                            <li>스팸 메시지함을 확인해주세요</li>
-                                                            <li>잠시 후 재전송 버튼을 이용해주세요</li>
+                                                            <li>{t('checkPhoneNumber')}</li>
+                                                            <li>{t('checkSpamFolder')}</li>
+                                                            <li>{t('useResendButton')}</li>
                                                         </ul>
                                                     </div>
                                                 </div>
@@ -673,7 +673,7 @@ export function LoginForm({
                                     <div className="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50">
                                         <div className="bg-white rounded-lg p-6 w-full max-w-md mx-4">
                                             <div className="flex justify-between items-center mb-4">
-                                                <h3 className="text-lg font-semibold">비밀번호 재설정</h3>
+                                                <h3 className="text-lg font-semibold">{t('resetPassword')}</h3>
                                                 <button
                                                     onClick={() => {
                                                         setShowForgotPassword(false);
@@ -686,12 +686,12 @@ export function LoginForm({
                                             <form action={passwordResetAction} className="space-y-4">
                                                 <div>
                                                     <p className="text-sm text-gray-600 mb-3">
-                                                        가입하신 이메일 주소를 입력하시면 비밀번호 재설정 링크를 보내드립니다.
+                                                        {t('resetDescription')}
                                                     </p>
                                                     <Input
                                                         name="email"
                                                         type="email"
-                                                        placeholder="이메일 주소"
+                                                        placeholder={t('emailAddress')}
                                                         required
                                                     />
                                                 </div>
@@ -704,13 +704,13 @@ export function LoginForm({
                                                             setShowForgotPassword(false);
                                                         }}
                                                     >
-                                                        취소
+                                                        {t('cancel')}
                                                     </Button>
                                                     <Button
                                                         type="submit"
                                                         className="flex-1"
                                                     >
-                                                        재설정 링크 전송
+                                                        {t('sendResetLink')}
                                                     </Button>
                                                 </div>
                                             </form>
@@ -784,6 +784,4 @@ export function LoginForm({
             </div>
         </div>
     )
-}
-
-
+}
\ No newline at end of file
-- 
cgit v1.2.3

