locastic/zxcvbn-password-validator

Realistic Symfony password strength validator based on Zxcvbn PHP

v1.3.1 2018-07-18 15:56 UTC

This package is auto-updated.

Last update: 2024-04-22 03:50:51 UTC


README

Realistic Symfony password strength validator based on Dropbox's zxcvbn project.

68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6c6f6361737469632f7a786376626e2d70617373776f72642d76616c696461746f722e737667 68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f4c6f6361737469632f7a786376626e2d70617373776f72642d76616c696461746f722e737667 68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f4c6f6361737469632f5a786376626e50617373776f726456616c696461746f722f6d61737465722e737667 68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f4c6f6361737469632f5a786376626e50617373776f726456616c696461746f722e737667 68747470733a2f2f706f7365722e707567782e6f72672f6c6f6361737469632f7a786376626e2d70617373776f72642d76616c696461746f722f646f776e6c6f616473

Overview

Zxcvbn-PHP is a password strength estimator using pattern matching and minimum entropy calculation. Zxcvbn-PHP is based on the Javascript zxcvbn project from Dropbox and @lowe. "zxcvbn" is bad password, just like "qwerty" and "123456".

More info here.

zxcvbn attempts to give sound password advice through pattern matching and conservative entropy calculations. It finds 10k common passwords, common American names and surnames, common English words, and common patterns like dates, repeats (aaa), sequences (abcd), and QWERTY patterns.

This validator is based on library: Zxcvbn-PHP

Installation

composer require locastic/zxcvbn-password-validator

Options

You can use the Locastic\Component\ZxcvbnPasswordValidator\Validator\Constraints\ZxcvbnPasswordValidator constraint with the following options.

Option Type Description
message string The validation message (default: password_too_weak)
minEntropy float Desired minimal entropy value (password strength

Annotations

If you are using annotations for validation, include the constraints namespace:

use Locastic\Component\ZxcvbnPasswordValidator\Validator\Constraints as LocasticPassword;

and then add the ZxcvbnPasswordValidator constraint to the relevant field:

/**
 * @LocasticPassword\ZxcvbnPasswordValidator(minEntropy=50)
 */
protected $password;

YAML

App\Entity\User:
    properties:
        password:
            - Locastic\Component\ZxcvbnPasswordValidator\Validator\Constraints\ZxcvbnPasswordValidator:
                 minEntropy: 50

Support

Need help at your project? Write us an email on info@locastic.com