You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
804 B
42 lines
804 B
import { z } from "zod" |
|
|
|
export const email = z |
|
.string() |
|
.email() |
|
.transform((str) => str.toLowerCase().trim()) |
|
|
|
export const password = z |
|
.string() |
|
.min(10) |
|
.max(100) |
|
.transform((str) => str.trim()) |
|
|
|
export const Signup = z.object({ |
|
email, |
|
password, |
|
}) |
|
|
|
export const Login = z.object({ |
|
email, |
|
password: z.string(), |
|
}) |
|
|
|
export const ForgotPassword = z.object({ |
|
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 |
|
}) |
|
|
|
export const ChangePassword = z.object({ |
|
currentPassword: z.string(), |
|
newPassword: password, |
|
})
|
|
|