shellphone.app/app/auth/validations.ts

29 lines
612 B
TypeScript

import { z } from "zod";
export const password = z.string().min(10).max(100);
export const Signup = z.object({
email: z.string().email(),
password,
});
export const Login = z.object({
email: z.string().email(),
password: z.string(),
});
export const ForgotPassword = z.object({
email: z.string().email(),
});
export const ResetPassword = z
.object({
password: password,
passwordConfirmation: password,
token: z.string(),
})
.refine((data) => data.password === data.passwordConfirmation, {
message: "Passwords don't match",
path: ["passwordConfirmation"], // set the path of the error
});