Re:Htmx Is the Future
by Dylan16807 on Friday May 05, 2023 @09:11PM
(#35836997)
If that's all you want then sure, but that's not what I would call a good password quality meter. It makes no attempt to look for patterns or words or super-common passwords.
As noted excuse the basic check functions and use whatever you actually want for check criteria and the amount of work on the server side is still 0 compared to extra effort to create a separate worse server side validation.
Re:Htmx Is the Future
by Dylan16807 on Saturday May 06, 2023 @07:26AM
(#35840251)
Your check functions are fine, for both client and server.
I'm not saying not to reuse things, because I specifically think it should be two separate functions on the client, one of which is copied to the server. But if you insist on having only one client function, I think the server function should be cut down.
And the premise is doing client-only advice on strength so I'm not going to challenge that premise.
As far as 50x, your code doesn't need those consts saying the exact same thing as the results object, so that simplifies to 8 lines, and I think 400 lines for a good password estimator isn't unreasonable. zxcvbn's scoring function is around that size.
Of particular note there is no UI code here because the meter's UI code is not related to the check function beyond it reads the return value.