Reset password comparison with Zod? #1104
Answered
by
scotttrinh
Rocinante89
asked this question in
Q&A
-
I'm banging my head against the wall with this, but is there any way to achieve comparing a new password & confirm new password inputs like you would find in a password reset form? I can handle it the old fashioned way, but I'm just wondering if i'm missing some clever way using the schema |
Beta Was this translation helpful? Give feedback.
Answered by
scotttrinh
Apr 29, 2022
Replies: 1 comment 1 reply
-
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); |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
Rocinante89
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is something like this what you had in mind?