shellphone.app/app/auth/validations.ts

30 lines
631 B
TypeScript
Raw Normal View History

import { z } from "zod";
2021-07-31 14:33:18 +00:00
export const password = z.string().min(10).max(100);
2021-07-31 14:33:18 +00:00
export const Signup = z.object({
2021-09-25 13:15:16 +00:00
name: z.string(),
2021-07-31 14:33:18 +00:00
email: z.string().email(),
password,
});
2021-07-31 14:33:18 +00:00
export const Login = z.object({
email: z.string().email(),
password: z.string(),
});
2021-07-31 14:33:18 +00:00
export const ForgotPassword = z.object({
email: z.string().email(),
});
2021-07-31 14:33:18 +00:00
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
});