horprogs / Just-validate

Modern, simple, lightweight (~5kb gzip) form validation library written in Typescript, with no dependencies (no JQuery!). Support a wide range of predefined rules, async, files, dates validation, custom error messages and styles, localization. Support writing custom rules and plugins.

Home Page:https://just-validate.dev/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Rule "password" does not allow special characters

thelittleerik opened this issue · comments

Description

When an input field receives a rule "password", the requirement indicates the following:

"Password must contain minimum eight characters, at least one letter and one number".

To Reproduce

  1. Create an input field
  2. In Javascript, add the rule "password"
  3. In my example I was able to recreate this issue with the following input as testing: secret1234! or secret1234@ or secret1234% etc.

Expected behavior
These properties AT LEAST are required, but if a stronger password is chosen with special characters, it should NOT throw back this previously mentioned error, rather if a user chooses a stronger one, they should not be limited from using special characters.

If I'd use a "strongPassword" rule, then it might seem less user-friendly, as not every user prefers strong ones, because then, everyone is forced to include a special character.

You are right. I'll adjust the regexp for checking the password

Should be fine now, thanks for spotting this.