X-Git-Url: https://git.heureux-cyclage.org/index.php?a=blobdiff_plain;f=includes%2FPreferences.php;h=70addfcf905d0ec53cbe195637b33f00c1252e19;hb=fcc3cd5341bd892820fdf8239350c49bdd19aa0d;hp=9a55ae3487696a9e2590fbdb67f7cab8a8fa9ead;hpb=462ae127e5d877008e76506272a53d99c5c996cc;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/Preferences.php b/includes/Preferences.php index 9a55ae3487..70addfcf90 100644 --- a/includes/Preferences.php +++ b/includes/Preferences.php @@ -207,8 +207,9 @@ class Preferences { * @return void */ static function profilePreferences( $user, IContextSource $context, &$defaultPreferences ) { - global $wgAuth, $wgContLang, $wgParser, $wgDisableAuthManager; + global $wgContLang, $wgParser; + $authManager = AuthManager::singleton(); $config = $context->getConfig(); // retrieving user name for GENDER and misc. $userName = $user->getName(); @@ -283,21 +284,19 @@ class Preferences { $canEditPrivateInfo = $user->isAllowed( 'editmyprivateinfo' ); // Actually changeable stuff - $realnameChangeAllowed = $wgDisableAuthManager ? $wgAuth->allowPropChange( 'realname' ) - : AuthManager::singleton()->allowsPropertyChange( 'realname' ); $defaultPreferences['realname'] = [ // (not really "private", but still shouldn't be edited without permission) - 'type' => $canEditPrivateInfo && $realnameChangeAllowed ? 'text' : 'info', + 'type' => $canEditPrivateInfo && $authManager->allowsPropertyChange( 'realname' ) + ? 'text' : 'info', 'default' => $user->getRealName(), 'section' => 'personal/info', 'label-message' => 'yourrealname', 'help-message' => 'prefs-help-realname', ]; - $allowPasswordChange = $wgDisableAuthManager ? $wgAuth->allowPasswordChange() - : AuthManager::singleton()->allowsAuthenticationDataChange( - new PasswordAuthenticationRequest(), false ); - if ( $canEditPrivateInfo && $allowPasswordChange ) { + if ( $canEditPrivateInfo && $authManager->allowsAuthenticationDataChange( + new PasswordAuthenticationRequest(), false )->isGood() + ) { $link = Linker::link( SpecialPage::getTitleFor( 'ChangePassword' ), $context->msg( 'prefs-resetpass' )->escaped(), [], [ 'returnto' => SpecialPage::getTitleFor( 'Preferences' )->getPrefixedText() ] ); @@ -418,10 +417,8 @@ class Preferences { 'default' => $oldsigHTML, 'section' => 'personal/signature', ]; - $nicknameChangeAllowed = $wgDisableAuthManager ? $wgAuth->allowPropChange( 'nickname' ) - : AuthManager::singleton()->allowsPropertyChange( 'nickname' ); $defaultPreferences['nickname'] = [ - 'type' => $nicknameChangeAllowed ? 'text' : 'info', + 'type' => $authManager->allowsPropertyChange( 'nickname' ) ? 'text' : 'info', 'maxlength' => $config->get( 'MaxSigChars' ), 'label-message' => 'yournick', 'validation-callback' => [ 'Preferences', 'validateSignature' ], @@ -450,9 +447,7 @@ class Preferences { } $emailAddress = $user->getEmail() ? htmlspecialchars( $user->getEmail() ) : ''; - $emailChangeAllowed = $wgDisableAuthManager ? $wgAuth->allowPropChange( 'emailaddress' ) - : AuthManager::singleton()->allowsPropertyChange( 'emailaddress' ); - if ( $canEditPrivateInfo && $emailChangeAllowed ) { + if ( $canEditPrivateInfo && $authManager->allowsPropertyChange( 'emailaddress' ) ) { $link = Linker::link( SpecialPage::getTitleFor( 'ChangeEmail' ), $context->msg( $user->getEmail() ? 'prefs-changeemail' : 'prefs-setemail' )->escaped(),