issue # 로그인, 회원가입, 비밀번호 초기화 Form schema 구현

This commit is contained in:
2025-11-07 05:41:16 +00:00
parent 917bef73b0
commit 85ff7e565b
4 changed files with 47 additions and 0 deletions

3
src/data/form/index.ts Normal file
View File

@@ -0,0 +1,3 @@
export { SignUpSchema } from './signup.schema';
export { LoginSchema } from './login.schema';
export { ResetPasswordSchema } from './resetPassword.schema';

View File

@@ -0,0 +1,13 @@
import * as z from 'zod';
import { zodResolver } from '@/hookform/resolvers/zod';
import { useForm } from 'react-hook-form';
const LoginSchema = z.object({
email: z
.email()
, password: z
.string()
.min(8, "비밀번호는 8-12 자리여야 합니다.")
.max(12, "비밀번호는 8-12 자리여야 합니다.")
.regex(\^[a-z](?=.*[0-9])(?=.*[!@#$]).*$\)
});

View File

@@ -0,0 +1,8 @@
import * as z from 'zod';
import { zodResolver } from '@/hookform/resolvers/zod';
import { useForm } from 'react-hook-form';
const ResetPasswordSchema = z.object({
email: z
.email()
});

View File

@@ -0,0 +1,23 @@
import * as z from 'zod';
import { zodResolver } from '@/hookform/resolvers/zod';
import { useForm } from 'react-hook-form';
const SignUpSchema = z.object({
email: z
.email()
, password: z
.string()
.min(8, "비밀번호는 8-12 자리여야 합니다.")
.max(12, "비밀번호는 8-12 자리여야 합니다.")
.regex(\^[a-z](?=.*[0-9])(?=.*[!@#$]).*$\, "영문 소문자로 시작하고 숫자와 특수문자(!@#$)를 포함해야 합니다.")
, name: z
.string()
, nickname: z
.string()
, passwordConfirm: z
.string()
})
.refine((data) => data.password === data.passwordConfirm, {
path: ["passwordConfirm"],
error: "비밀번호가 일치하지 않습니다."
});