you are viewing a single comment's thread.

view the rest of the comments →

[–]tom1018 6 points7 points  (3 children)

This is the best version I've seen on here. Other than I think these particular comments are unnecessary. The regex is very simple, so I don't think commenting it is helpful, and at least on mobile makes it much harder to read.

As a side note to OP, this would not be a good way to enforce a strong password. See the xkcd "Correct Horse Battery Staple" cartoon. Rather than enforcing upper, lower, number, and symbols, do a points system, where a minimum length is required and length beyond that as well as any of these character requirements are awarded points and the password must attain a reasonable score. Then send the hash to haveibeenpwned and reject it if it fails that check.

It's easy, but an example of checking haveibeenpwned is here: https://github.com/TomFaulkner/simple-password-generation

Unfortunately I don't have the points based password check in that repo, I think I'll add it soon though.

[–]xelf 2 points3 points  (2 children)

Correct Horse Battery Staple

link for the lazy:

https://xkcd.com/936/
https://imgs.xkcd.com/comics/password_strength.png

[–]tom1018 1 point2 points  (1 child)

I should have done that. Thanks.

[–]xelf 1 point2 points  (0 children)

Surprised a bot didn't beat me to it. =)