X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2Fauth%2FTemporaryPasswordAuthenticationRequest.php;h=1c87ea9ea283d4ca07e3b336ac3ca2afb430375e;hb=88e3a888cc6823f11df79ac53eb963a7e4d2871a;hp=c8580520e3ff131f33d23dc0b6a44bd38466e506;hpb=0295e7260bf52a1fc6c051ad010c40abd79e1721;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/auth/TemporaryPasswordAuthenticationRequest.php b/includes/auth/TemporaryPasswordAuthenticationRequest.php index c8580520e3..1c87ea9ea2 100644 --- a/includes/auth/TemporaryPasswordAuthenticationRequest.php +++ b/includes/auth/TemporaryPasswordAuthenticationRequest.php @@ -21,6 +21,8 @@ namespace MediaWiki\Auth; +use MediaWiki\MediaWikiServices; + /** * This represents the intention to set a temporary password for the user. * @ingroup Auth @@ -61,17 +63,14 @@ class TemporaryPasswordAuthenticationRequest extends AuthenticationRequest { * @return TemporaryPasswordAuthenticationRequest */ public static function newRandom() { - $config = \ConfigFactory::getDefaultInstance()->makeConfig( 'main' ); + $config = MediaWikiServices::getInstance()->getMainConfig(); // get the min password length $minLength = $config->get( 'MinimalPasswordLength' ); $policy = $config->get( 'PasswordPolicy' ); foreach ( $policy['policies'] as $p ) { - if ( isset( $p['MinimalPasswordLength'] ) ) { - $minLength = max( $minLength, $p['MinimalPasswordLength'] ); - } - if ( isset( $p['MinimalPasswordLengthToLogin'] ) ) { - $minLength = max( $minLength, $p['MinimalPasswordLengthToLogin'] ); + foreach ( [ 'MinimalPasswordLength', 'MinimumPasswordLengthToLogin' ] as $check ) { + $minLength = max( $minLength, $p[$check]['value'] ?? $p[$check] ?? 0 ); } }