mirror of
https://github.com/diced/zipline.git
synced 2026-06-12 19:01:18 -07:00
fix: passkey fields validation (#1047)
This commit is contained in:
@@ -268,14 +268,21 @@ export const schema = z.object({
|
||||
rpID: z
|
||||
.string()
|
||||
.trim()
|
||||
.refine(
|
||||
(v) => v.length === 0 || /^[a-zA-Z0-9.-]+$/.test(v),
|
||||
'RP ID can only contain letters, numbers, dots, and hyphens. Example: example.com, localhost, zipline.example.com.',
|
||||
)
|
||||
.transform((v) => (v.length > 0 ? v : null))
|
||||
.nullable()
|
||||
.default(null),
|
||||
origin: z
|
||||
.string()
|
||||
.trim()
|
||||
.refine(
|
||||
(v) => v.length === 0 || /^https?:\/\/[a-zA-Z0-9.-]+(:\d+)?(\/.*)?$/.test(v),
|
||||
'Origin must be a valid URL starting with http:// or https://',
|
||||
)
|
||||
.transform((v) => (v.length > 0 ? v : null))
|
||||
.refine((v) => (v ? URL.canParse(v) : true), 'Invalid URL')
|
||||
.nullable()
|
||||
.default(null),
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user