Closed mahesh1996 closed 4 years ago
You'll have to elaborate on this request. There is an AllowedRegexRule
and IllegalRegexRule
, both of which expose the Pattern
they are using.
Yes AllowedRegexRule
and IllegalRegexRule
both generate Pattern
but consider the below scenario.
There is a system in which a person can create a set of rules (e.g combination of LengthRule
and AllowedCharacterRule
) from UI but hasn't knowledge of Regex. Now whenever in any place in UI I want to apply this rule from client-side validation, I need regex. So if Passay
allows generating regex of the set of rules then I can directly provide Regex to UI and then can validate accordingly.
Right now UI also has to implement a set of Rules provided by Passay
for such scenario.
Please revert If I am missing anything.
Even if I was confident I could generate a regular expression for some set of rules in Java, I wouldn't be confident that same expression would be functionally the same in JavaScript. Also note that many rules can't be expressed as regular expressions, so any implementation would have to use a subset of the available rules.
The typical approach right now is to expose your password validation as a RESTful endpoint that returns JSON and use that endpoint for validation in your client code.
No feedback from reporter. Feel free to reopen this for further discussion.
The library should have an option to generate regex containing a set of rules. This will help to generate regex which can be used for client-side validation also.