-
Notifications
You must be signed in to change notification settings - Fork 64
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
Consider adding validation rule displayable hint messages #99
Comments
I have implemented some variation of this atop the library, as part of making it possible to construct a password policy from a configuration and then serialize it into a more structured representation (so I assembled a list of these messages though I haven't yet made it possible to configure them or integrated it with the library code itself) This is what I came up with, anyway:
(I didn't make any attempt to include 'wrap' or 'backwards' behaviours in the descriptions so far.) Per above, it also requires some transformation of MatchBehavior, CharacterData, and SequenceData into a natural language form, and a string representation of an Interval. It would also benefit from a "user-intelligible" description of a Regex Pattern. Maybe that will help someone take the idea further. |
Similar map of messages, one for each rule, that could be obtained from a PasswordValidator instance for the configured rules. The expected use would be to display to a user before validation, for the rules actually configured.
exampless:
INSUFFICIENT_LOWERCASE=At least %1$s uppercase characters
INSUFFICIENT_SPECIAL=At least %1$s special character (ex. @%$#& etc.)
TOO_SHORT=At least %1$s characters in length
TOO_LONG=No more than %1$s characters in length
Map<String,String> hintMap = validator.getRuleHints();
The text was updated successfully, but these errors were encountered: