Skip to content

Automattic/jetpack-password-checker

v0.1.7
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
src
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Password Checker

Password Checker package.

Usage

Add a new test:

$tests = array(
	'preg_match'      => array(
		'no_backslashes' => array(
			'pattern'          => '/^[^\\\\]*$/u',
			'error'            => __( 'Passwords may not contain the character "\".', 'jetpack' ),
			'required'         => true,
			'fail_immediately' => true,
		),
	),
	'compare_to_list' => array(
		'not_a_common_password' => array(
			'list_callback'    => 'get_common_passwords',
			'compare_callback' => 'negative_in_array',
			'error'            => __( 'This is a very common password. Choose something that will be harder for others to guess.', 'jetpack' ),
			'required'         => true,
		),
	)
);
$tests = apply_filters( 'password_checker_tests', $tests );

Test a password:

use Automattic\Jetpack\Password_Checker;

$user = new WP_User( 1 );
$password_checker = new Password_Checker( $user );
$password_checker->test( '123', true );

About

[READ ONLY] Password Checker. This repository is a mirror, for issue tracking and development head to: https://github.com/automattic/jetpack

Resources

License

Security policy

Stars

Watchers

Forks

Languages