shellphone.app/app/features/auth/validations.ts

42 lines
874 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
2022-05-14 10:22:06 +00:00
export const Register = z.object({
orgName: z.string().nonempty(),
fullName: z.string().nonempty(),
2021-07-31 14:33:18 +00:00
email: z.string().email(),
password,
});
2021-07-31 14:33:18 +00:00
2022-05-14 10:22:06 +00:00
export const SignIn = z.object({
2021-07-31 14:33:18 +00:00
email: z.string().email(),
2022-05-14 10:22:06 +00:00
password,
});
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
});
2022-05-14 10:22:06 +00:00
export const AcceptInvitation = z.object({
fullName: z.string(),
email: z.string().email(),
password,
token: z.string(),
});
export const AcceptAuthedInvitation = z.object({
token: z.string(),
});