This commit is contained in:
Santiago Lo Coco 2024-05-09 11:48:04 +02:00
parent 7d0bf9b3ef
commit 8d1e755bbc
1 changed files with 16 additions and 8 deletions

View File

@ -19,11 +19,19 @@ import * as z from "zod"
import type { Actions } from "./$types" import type { Actions } from "./$types"
const signUpSchema = z.object({ const signUpSchema = z.object({
username: z.string().min(6).max(128).regex( username: z
.string()
.min(6)
.max(128)
.regex(
/^[a-zA-Z0-9_-]+$/, /^[a-zA-Z0-9_-]+$/,
"Username may only contain letters, numbers, hyphens, and underscores" "Username may only contain letters, numbers, hyphens, and underscores"
), ),
password: z.string().min(8).max(128).regex( password: z
.string()
.min(8)
.max(128)
.regex(
/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[!@#$%^&*()_+}{"':;?/><.,\|]).{8,}$/, /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[!@#$%^&*()_+}{"':;?/><.,\|]).{8,}$/,
"Password requires at least one lowercase letter, one uppercase letter, one digit, and one special character" "Password requires at least one lowercase letter, one uppercase letter, one digit, and one special character"
), ),