fix: replace enter details first-/lastname regex
This commit is contained in:
@@ -2,7 +2,8 @@ import { z } from "zod"
|
|||||||
|
|
||||||
import { phoneValidator } from "@/utils/phoneValidator"
|
import { phoneValidator } from "@/utils/phoneValidator"
|
||||||
|
|
||||||
const stringMatcher = /^[\p{L}\s\-\.]+$/u
|
const stringMatcher =
|
||||||
|
/^[A-Za-z¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ0-9-\s]*$/
|
||||||
|
|
||||||
const isValidString = (key: string) => stringMatcher.test(key)
|
const isValidString = (key: string) => stringMatcher.test(key)
|
||||||
|
|
||||||
@@ -13,13 +14,13 @@ export const baseDetailsSchema = z.object({
|
|||||||
.string()
|
.string()
|
||||||
.min(1, { message: "First name is required" })
|
.min(1, { message: "First name is required" })
|
||||||
.refine(isValidString, {
|
.refine(isValidString, {
|
||||||
message: "First name can't contain any special charachters",
|
message: "First name can't contain any special characters",
|
||||||
}),
|
}),
|
||||||
lastName: z
|
lastName: z
|
||||||
.string()
|
.string()
|
||||||
.min(1, { message: "Last name is required" })
|
.min(1, { message: "Last name is required" })
|
||||||
.refine(isValidString, {
|
.refine(isValidString, {
|
||||||
message: "Last name can't contain any special charachters",
|
message: "Last name can't contain any special characters",
|
||||||
}),
|
}),
|
||||||
phoneNumber: phoneValidator(),
|
phoneNumber: phoneValidator(),
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user