deprecated in 1.32, have been removed.
* OutputPage::getModuleScripts(), ParserOutput::getModuleScripts(), deprecated
in 1.33, have been removed.
+* User::getPasswordValidity(), deprecated in 1.33, has been removed.
* …
=== Deprecations in 1.34 ===
return $this->checkPasswordValidity( $password )->isGood();
}
- /**
- * Given unvalidated password input, return error message on failure.
- *
- * @param string $password Desired password
- * @return bool|string|array True on success, string or array of error message on failure
- * @deprecated since 1.33, use checkPasswordValidity
- */
- public function getPasswordValidity( $password ) {
- wfDeprecated( __METHOD__, '1.33' );
-
- $result = $this->checkPasswordValidity( $password );
- if ( $result->isGood() ) {
- return true;
- }
-
- $messages = [];
- foreach ( $result->getErrorsByType( 'error' ) as $error ) {
- $messages[] = $error['message'];
- }
- foreach ( $result->getErrorsByType( 'warning' ) as $warning ) {
- $messages[] = $warning['message'];
- }
- if ( count( $messages ) === 1 ) {
- return $messages[0];
- }
-
- return $messages;
- }
-
/**
* Check if this is a valid password for this user
*
* - ensure the password is not the same as the username
* - ensure the username/password combo isn't forbidden
* @covers User::checkPasswordValidity()
- * @covers User::getPasswordValidity()
* @covers User::isValidPassword()
*/
public function testCheckPasswordValidity() {
],
],
] );
- $this->hideDeprecated( 'User::getPasswordValidity' );
$user = static::getTestUser()->getUser();
$this->assertFalse( $user->isValidPassword( 'a' ) );
$this->assertFalse( $user->checkPasswordValidity( 'a' )->isGood() );
$this->assertTrue( $user->checkPasswordValidity( 'a' )->isOK() );
- $this->assertEquals( 'passwordtooshort', $user->getPasswordValidity( 'a' ) );
// Maximum length
$longPass = str_repeat( 'a', 41 );
$this->assertFalse( $user->isValidPassword( $longPass ) );
$this->assertFalse( $user->checkPasswordValidity( $longPass )->isGood() );
$this->assertFalse( $user->checkPasswordValidity( $longPass )->isOK() );
- $this->assertEquals( 'passwordtoolong', $user->getPasswordValidity( $longPass ) );
// Matches username
$this->assertFalse( $user->checkPasswordValidity( $user->getName() )->isGood() );
$this->assertTrue( $user->checkPasswordValidity( $user->getName() )->isOK() );
- $this->assertEquals( 'password-name-match', $user->getPasswordValidity( $user->getName() ) );
// On the forbidden list
$user = User::newFromName( 'Useruser' );
$this->assertFalse( $user->checkPasswordValidity( 'Passpass' )->isGood() );
- $this->assertEquals( 'password-login-forbidden', $user->getPasswordValidity( 'Passpass' ) );
}
/**