-
-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
password() message #7
Comments
the however, if more people would like this option I will not object to it. two variations come to mind: // 1st option
.password({
messages: {
minLowercase: 'custom message',
minUppercase: 'custom message',
...
},
rules: {
minLowercase: 2,
minUppercase: 3,
...
},
})
// 2nd option
.password({
minLowercase: [2, 'custom message'],
minUppercase: [2, 'custom message'],
..
}) also lets compare it to this: .password().minLowercase(2, 'custom message').minUppercase(3, 'custom message') additional ideas are welcome |
closing this ticket for now. if anyone thinks this is a useful option to have and/or have any additional ideas please drop them here and will reopen the ticket for discussion. |
Just a tiny issue, maybe I missed this in the docs. Say I have a field name as "currentPassword". The returned error message would be displayed as ie: "currentPassword must contain at least 1 uppercase letter". Do you have any option to change the name set into the error message? I hope the description explains the issue clearly. Let me know if you prefer this to be opened as a new issue. Tagged here since I thought this can be related to the current topic. Thanks! |
@MadhawaS96 you can use Schema.label() const schema = yup.object().shape({
currentPassword: yup.string().password().required().label('Current password'),
}) |
Brilliant! Thank you so much for both the answer and your quick response. Much appreciated! |
.password() method does not take message argument (other method do have it)
The text was updated successfully, but these errors were encountered: