CenturyLinkCloud / Cyclops

The UX/UI Pattern Guide for the CenturyLink Platform
http://assets.ctl.io/cyclops
MIT License
20 stars 16 forks source link

Logic error in password strength validation #154

Closed guyaparker closed 6 years ago

guyaparker commented 6 years ago

There is a logic error in the function helpers.calculatePasswordStrength when the password strength is set to 2. Strength 2 should enforce a minimum of 8 characters and 3 char types but validation will fail if the test is against a string that is 8 characters containing 4 char types.

I think the "(password.length === 8 && charTypes === 3)" in the helpers.calculatePasswordStrength function should be "(password.length === 8 && charTypes >= 3)":

if (password.length < 8) { strength = 0; } else if (charTypes < 3) { strength = 1; } else if (password.length === 8 && charTypes === 3) { strength = 2; } else if (password.length >= 9 && charTypes === 3) { strength = 3; } else if (password.length >= 9 && charTypes === 4) { strength = 4; } else { strength = 0; }

jsmecham commented 6 years ago

Hi @guyaparker, can you take a look at #156 and let me know if this fixes the behavior for you?

jsmecham commented 6 years ago

Closed by #156.

guyaparker commented 6 years ago

Hi @jsmecham - sorry for delayed response. Yes, that change is the one I did locally when I diagnosed the issue so I know that works.

Thanks!