Skip to content
Snippets Groups Projects
auth.ts 661 B
import * as z from "zod"

export const userAuthSchema = z.object({
    usernameOrEmail: z
        .union([
            z.string().min(3, "Username or email must be at least 3 characters").max(15, "Username or email must be at most 15 characters"),
            z.string().email("Invalid email format"),
        ])
        .optional(),
    username: z.string().min(3, "Username must be at least 3 characters").max(15, "Username must be at most 15 characters").optional(),
    email: z.string().email("Invalid email format").optional(),
    password: z.string().min(6, "Password must be at least 6 characters").max(18, "Password must be at most 18 characters"),
})