20 lines
653 B
TypeScript
20 lines
653 B
TypeScript
import { Validator } from '@/util/Validator';
|
|
import * as z from 'zod';
|
|
|
|
export const LoginSchema = z.object({
|
|
id: z
|
|
.string()
|
|
.refine((val) => {
|
|
if (val.includes('@')) {
|
|
return Validator.isEmail(val);;
|
|
}
|
|
return true;
|
|
}, {
|
|
message: "이메일 형식이 올바르지 않습니다."
|
|
})
|
|
, password: z
|
|
.string()
|
|
.min(8, "비밀번호는 8-12 자리여야 합니다.")
|
|
.max(12, "비밀번호는 8-12 자리여야 합니다.")
|
|
.regex(/^(?=.*[0-9])(?=.*[!@#$%^])[a-zA-Z0-9!@#$%^]+$/, "비밀번호는 영소문자로 시작하여 숫자, 특수문자(!@#$)를 한 개 이상 포함하여야 합니다.")
|
|
}); |