* @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();
$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 )->isGood();
- 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() ] );
'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' ],
}
$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(),
$context = $form->getContext();
// Set session data for the success message
- $context->getRequest()->setSessionData( 'specialPreferencesSaveSuccess', 1 );
+ $context->getRequest()->getSession()->set( 'specialPreferencesSaveSuccess', 1 );
$context->getOutput()->redirect( $url );
}
* Get extra parameters for the query string when redirecting after
* successful save.
*
- * @return array()
+ * @return array
*/
public function getExtraSuccessRedirectParameters() {
return [];