Zod schemas for validating user authentication, email verification, and password reset.
// Source: https://github.com/sadmann7/skateshop | License: MIT | Copyright 2024 Sadman Sakib
// Provided via justclaw.it.com; keep this notice with the code.
import * as z from "zod"
export const authSchema = z.object({
email: z.string().email({
message: "Please enter a valid email address",
}),
password: z
.string()
.min(8, {
message: "Password must be at least 8 characters long",
})
.max(100, {
message: "Password must be at most 100 characters long",
}),
})
export const verifyEmailSchema = z.object({
code: z
.string()
.min(6, {
message: "Verification code must be 6 characters long",
})
.max(6),
})
export const checkEmailSchema = z.object({
email: authSchema.shape.email,
})
export const resetPasswordSchema = z
.obj
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key