better-chatbot / src /lib /validations /password.ts
Bot
Initial commit for HF Spaces
05c5ed5
Raw
History Blame Contribute Delete
649 Bytes
import { z } from "zod";
export const passwordRegexPattern =
process.env.NEXT_PUBLIC_PASSWORD_REGEX_PATTERN ||
"^(?=.*[a-zA-Z])(?=.*\\d)[a-zA-Z\\d!@#$%^&*()_+\\-=\\[\\]{};':\"\\\\|,.<>\\/?]{8,20}$";
export const passwordRequirementsText =
process.env.NEXT_PUBLIC_PASSWORD_REQUIREMENTS_TEXT ||
"Password must be 8-20 characters and contain at least one letter and one number.";
// Shared password validation schema
export const passwordSchema = z
.string()
.min(8, "Password must be at least 8 characters long.")
.max(20, "Password cannot exceed 20 characters.")
.regex(new RegExp(passwordRegexPattern), passwordRequirementsText);