allow wildcard emails in email whitelist

This commit is contained in:
Milo Schwartz
2025-01-26 18:12:30 -05:00
parent 9f1f2910e4
commit 61b34c8b16
4 changed files with 104 additions and 16 deletions

View File

@@ -12,7 +12,17 @@ import { and, eq } from "drizzle-orm";
const setResourceWhitelistBodySchema = z
.object({
emails: z
.array(z.string().email())
.array(
z
.string()
.email()
.or(
z.string().regex(/^\*@[\w.-]+\.[a-zA-Z]{2,}$/, {
message:
"Invalid email address. Wildcard (*) must be the entire local part."
})
)
)
.max(50)
.transform((v) => v.map((e) => e.toLowerCase()))
})