Replies: 1 comment
-
The easiest way is probably with const DISALLOWED_DOMAINS = ["@gmail.com"];
const schema = z.string().email().superRefine((email, ctx) => {
if (DISALLOWED_DOMAINS.some(domain => email.toLowerCase().endsWith(domain))) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: "The email domain is not allowed."
});
}
}); |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hey how to block the temporary email providers with email schema?
Beta Was this translation helpful? Give feedback.
All reactions