validator.js icon indicating copy to clipboard operation
validator.js copied to clipboard

Export analyzePassword Function

Open THILAK6 opened this issue 1 year ago • 4 comments

Initially pointed out in #1966 to adapt isStrongPassword to return count of all type of characters in the password. The responsibility of isStrongPassword should only be to check if the password is strong or not. So instead of modifying isStrongPassword, analyzePassword is exported which can be used to know the count of all type of characters in the password.

The issue is also attempted to solve here #2033

Checklist

  • [x] PR contains only changes related; no stray files, etc.
  • [x] README updated (where applicable)
  • [ ] Tests written (where applicable)
  • [x] References provided in PR (where applicable)

THILAK6 avatar Oct 01 '24 11:10 THILAK6

I guess we should also include tests for it individually. Also could you fix the failed tests

rubiin avatar Oct 01 '24 12:10 rubiin

just my 2 cents here: but it feels like this would not really fit the scope of the project - you have validators and sanitizers in here, this analyzePassword function does not really fit into any category.

But this is not really my decision to make - so maybe to be discussed?

pano9000 avatar Oct 01 '24 20:10 pano9000

I completely understand the concern regarding the scope of the project, as analyzePassword doesn’t fit neatly into the validator or sanitizer categories. Then we might need to fall back to the initial idea of extending the isStrongPassword function with an option to return analysis, but again I feel that's not the responsibility of isStrongPassword. I'm happy to take it in either direction based on what fits best with the project’s goals.

THILAK6 avatar Oct 02 '24 04:10 THILAK6

Hello all, any updates on this? I'm totally keen on this feature for my website, please. Thanks :)

binarykitchen avatar Nov 07 '25 23:11 binarykitchen