Created
February 9, 2020 11:45
-
-
Save trenskow/e387d73550a8df104253edcb4c9b4d8f to your computer and use it in GitHub Desktop.
How to check if two password are equal using invalid.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const user = await isvalid(/* data */, | |
{ | |
type: Object, | |
schema: { | |
'username': { /* username validators */ }, | |
'password': { type: String, required: true, match: /* some regular expression */ }, | |
'password_repeated': { type: String, required: true } | |
}, | |
post: (obj) { | |
if (obj.password !== obj.password_repeated) { | |
throw new Error('Passwords must be the same.'); | |
} | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment