27use Wikimedia\CommonPasswords\CommonPasswords;
50 $status = Status::newGood();
51 if ( $policyVal > strlen( $password ) ) {
52 $status->error(
'passwordtooshort', $policyVal );
67 $status = Status::newGood();
68 if ( $policyVal > strlen( $password ) ) {
69 $status->fatal(
'passwordtooshort', $policyVal );
83 $status = Status::newGood();
84 if ( $policyVal < strlen( $password ) ) {
85 $status->fatal(
'passwordtoolong', $policyVal );
102 $status = Status::newGood();
104 if ( $policyVal && stripos( $username, $password ) !==
false ) {
105 $status->error(
'password-substring-username-match' );
118 static $blockedLogins = [
120 'Useruser' =>
'Passpass',
121 'Useruser1' =>
'Passpass1',
123 'Apitestsysop' =>
'testpass',
124 'Apitestuser' =>
'testpass',
127 $status = Status::newGood();
131 isset( $blockedLogins[$username] ) &&
132 hash_equals( $blockedLogins[$username], $password )
134 $status->error(
'password-login-forbidden' );
138 if ( hash_equals(
'ExamplePassword', $password ) ) {
139 $status->error(
'password-login-forbidden' );
160 $status = Status::newGood();
161 if ( $policyVal && CommonPasswords::isCommon( $password ) ) {
162 $status->error(
'passwordincommonlist' );