Skip to content

Reset password comparison with Zod? #1104

Answered by scotttrinh
Rocinante89 asked this question in Q&A
Discussion options

You must be logged in to vote

Is something like this what you had in mind?

const newUserSchema = z
  .object({
    username: z.string().min(2),
    password: z.string().min(8),
    confirm: z.string().min(8),
  })
  .refine(({ password, confirm }) => password === confirm);

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Rocinante89
Comment options

Answer selected by Rocinante89
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants