This commit is contained in:
Nathnael
2026-07-09 08:55:06 +00:00
parent e3baf27a3e
commit 3f7734fe16
3 changed files with 43 additions and 17 deletions

View File

@@ -6,7 +6,10 @@ export const passwordRequirements = [
{ label: "One uppercase letter", test: (v: string) => /[A-Z]/.test(v) },
{ label: "One lowercase letter", test: (v: string) => /[a-z]/.test(v) },
{ label: "One number", test: (v: string) => /\d/.test(v) },
{ label: "One special character", test: (v: string) => /[^A-Za-z0-9]/.test(v) },
{
label: "One special character",
test: (v: string) => /[^A-Za-z0-9]/.test(v),
},
] as const;
/**
@@ -21,15 +24,14 @@ export const passwordField = z
.regex(/\d/, "Password must include a number")
.regex(/[^A-Za-z0-9]/, "Password must include a special character");
export const confirmPasswordField = z.string().min(1, "Please confirm your password");
export const confirmPasswordField = z
.string()
.min(1, "Please confirm your password");
export const samePassword = (data: { password: string; confirmPassword: string }) =>
data.password === data.confirmPassword;
export const PASSWORD_MISMATCH = {
message: "Passwords do not match",
path: ["confirmPassword"],
} as const;
export const samePassword = (data: {
password: string;
confirmPassword: string;
}) => data.password === data.confirmPassword;
/** Every requirement in {@link passwordRequirements} is satisfied. */
export const meetsAllRequirements = (value: string) =>