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