import React, { useState } from 'react'; import { Key, Eye, EyeOff } from 'lucide-react'; import { Button } from '@/components/ui/button'; import { Input } from '@/components/ui/input'; import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from '@/components/ui/form'; import { useForm } from 'react-hook-form'; import { z } from 'zod'; import { zodResolver } from '@hookform/resolvers/zod'; import { useToast } from '@/hooks/useToast.wrapper'; import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger } from '@/components/ui/alert-dialog'; const passwordFormSchema = z.object({ currentPassword: z.string().min(6, { message: '비밀번호는 6자 이상이어야 합니다.', }), newPassword: z.string().min(8, { message: '새 비밀번호는 8자 이상이어야 합니다.', }), confirmPassword: z.string().min(8, { message: '비밀번호 확인은 8자 이상이어야 합니다.', }), }).refine((data) => data.newPassword === data.confirmPassword, { message: "비밀번호가 일치하지 않습니다.", path: ["confirmPassword"], }); type PasswordFormValues = z.infer; const PasswordChangeForm = () => { const { toast } = useToast(); const [showCurrentPassword, setShowCurrentPassword] = useState(false); const [showNewPassword, setShowNewPassword] = useState(false); const [showConfirmPassword, setShowConfirmPassword] = useState(false); const passwordForm = useForm({ resolver: zodResolver(passwordFormSchema), defaultValues: { currentPassword: '', newPassword: '', confirmPassword: '', }, }); const onPasswordSubmit = (data: PasswordFormValues) => { console.log('Password form submitted:', data); // Here you would typically update the password toast({ title: "비밀번호 변경 완료", description: "비밀번호가 성공적으로 변경되었습니다.", }); passwordForm.reset(); }; return (

비밀번호 변경

( 현재 비밀번호
)} /> ( 새 비밀번호
)} /> ( 비밀번호 확인
)} /> 비밀번호 변경 확인 비밀번호를 변경하시겠습니까? 변경 후에는 새 비밀번호로 로그인해야 합니다. 취소 변경
); }; export default PasswordChangeForm;