Building a password strength meter

In this example, we will use the PasswordStrength plugin to build a password strength meter. It is powered by the Dropbox's zxcvbn library.

For anyone who haven't known about zxcvbn library, it's a password strength estimator inspired by password crackers developed by Dropbox. It can recognize and weighs 30k common passwords. For more information about this library, you can refer to its official page.

Using the PasswordStrength plugin, it's quite easy for us to see how strong a given password is:

The onValidated callback is executed after zxcvbn calculates the password's score which is passed as score parameter.

It is an integer number between 0 and 4 indicating the strength level:

Score Description
0 Too guessable: risky password
1 Very guessable: protection from throttled online attacks
2 Somewhat guessable: protection from unthrottled online attacks
3 Safely unguessable: moderate protection from offline slow-hash scenario
4 Very unguessable: strong protection from offline slow-hash scenario

Using the score value, we can show a meter to let user know how strong password is.

If your form uses one of the following plugin, you can use the framework progress bar component as listed in the table below:

Plugin Progress bar component
Bootstrap plugin https://getbootstrap.com/docs/4.3/components/progress/
Bootstrap3 plugin https://getbootstrap.com/docs/3.4/components/#progress
Bulma plugin https://bulma.io/documentation/elements/progress/
Foundation plugin https://foundation.zurb.com/sites/docs/progress-bar.html
Mini plugin https://minicss.org/docs#progress-bars
Semantic plugin https://semantic-ui.com/modules/progress.html
Shoelace plugin https://www.shoelace.style/docs/progress-bars.html
Spectre plugin https://picturepan2.github.io/spectre/experimentals/progress.html
Turret plugin https://turretcss.com/form/progress/
UIKit plugin https://getuikit.com/docs/progress

More examples