From 1c653c940fba07fa91db5fff8de22ac95d51c272 Mon Sep 17 00:00:00 2001
From: joonhoekim <26rote@gmail.com>
Date: Wed, 20 Aug 2025 03:38:55 +0000
Subject: (김준회) reset-password i18n 처리, vendorData 측 잘못된 unique
제약조건 삭제 (내부망DB에는 이미 삭제되어 있음)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
components/login/reset-password.tsx | 55 +++++++++++++++++++------------------
1 file changed, 28 insertions(+), 27 deletions(-)
(limited to 'components/login')
diff --git a/components/login/reset-password.tsx b/components/login/reset-password.tsx
index f68018d9..cc09f4fb 100644
--- a/components/login/reset-password.tsx
+++ b/components/login/reset-password.tsx
@@ -1,7 +1,6 @@
'use client';
import { useState, useEffect } from 'react';
-import { useRouter } from 'next/navigation';
import { useFormState } from 'react-dom';
import { useToast } from '@/hooks/use-toast';
import { Button } from '@/components/ui/button';
@@ -12,6 +11,7 @@ import Link from 'next/link';
import SuccessPage from './SuccessPage';
import { PasswordPolicy } from '@/lib/users/auth/passwordUtil';
import { PasswordValidationResult, resetPasswordAction, validatePasswordAction } from '@/lib/users/auth/partners-auth';
+import { useTranslation } from '@/i18n/client';
interface PasswordRequirement {
text: string;
@@ -23,11 +23,12 @@ interface Props {
token: string;
userId: number;
passwordPolicy: PasswordPolicy;
+ lng?: string;
}
-export default function ResetPasswordForm({ token, userId, passwordPolicy }: Props) {
- const router = useRouter();
+export default function ResetPasswordForm({ token, userId, passwordPolicy, lng = 'ko' }: Props) {
const { toast } = useToast();
+ const { t } = useTranslation(lng, 'login');
// 상태 관리
const [showPassword, setShowPassword] = useState(false);
@@ -75,12 +76,12 @@ export default function ResetPasswordForm({ token, userId, passwordPolicy }: Pro
useEffect(() => {
if (resetState.error) {
toast({
- title: '오류',
+ title: t('error'),
description: resetState.error,
variant: 'destructive',
});
}
- }, [resetState, toast]);
+ }, [resetState, toast, t]);
// 패스워드 요구사항 생성
const getPasswordRequirements = (): PasswordRequirement[] => {
@@ -89,7 +90,7 @@ export default function ResetPasswordForm({ token, userId, passwordPolicy }: Pro
const { strength } = passwordValidation;
const requirements: PasswordRequirement[] = [
{
- text: `${passwordPolicy.minLength}자 이상`,
+ text: `${passwordPolicy.minLength}${t('passwordRequirementLength')}`,
met: strength.length >= passwordPolicy.minLength,
type: 'length'
}
@@ -97,7 +98,7 @@ export default function ResetPasswordForm({ token, userId, passwordPolicy }: Pro
if (passwordPolicy.requireUppercase) {
requirements.push({
- text: '대문자 포함',
+ text: t('passwordRequirementUppercase'),
met: strength.hasUppercase,
type: 'uppercase'
});
@@ -105,7 +106,7 @@ export default function ResetPasswordForm({ token, userId, passwordPolicy }: Pro
if (passwordPolicy.requireLowercase) {
requirements.push({
- text: '소문자 포함',
+ text: t('passwordRequirementLowercase'),
met: strength.hasLowercase,
type: 'lowercase'
});
@@ -113,7 +114,7 @@ export default function ResetPasswordForm({ token, userId, passwordPolicy }: Pro
if (passwordPolicy.requireNumbers) {
requirements.push({
- text: '숫자 포함',
+ text: t('passwordRequirementNumbers'),
met: strength.hasNumbers,
type: 'number'
});
@@ -121,7 +122,7 @@ export default function ResetPasswordForm({ token, userId, passwordPolicy }: Pro
if (passwordPolicy.requireSymbols) {
requirements.push({
- text: '특수문자 포함',
+ text: t('passwordRequirementSymbols'),
met: strength.hasSymbols,
type: 'symbol'
});
@@ -144,11 +145,11 @@ export default function ResetPasswordForm({ token, userId, passwordPolicy }: Pro
const getStrengthText = (score: number) => {
switch (score) {
- case 1: return '매우 약함';
- case 2: return '약함';
- case 3: return '보통';
- case 4: return '강함';
- case 5: return '매우 강함';
+ case 1: return t('passwordStrengthVeryWeak');
+ case 2: return t('passwordStrengthWeak');
+ case 3: return t('passwordStrengthMedium');
+ case 4: return t('passwordStrengthStrong');
+ case 5: return t('passwordStrengthVeryStrong');
default: return '';
}
};
@@ -170,9 +171,9 @@ export default function ResetPasswordForm({ token, userId, passwordPolicy }: Pro