From: jenkins-bot Date: Thu, 26 Oct 2017 22:44:23 +0000 (+0000) Subject: Merge "CheckBlocksSecondaryAuthenticationProvider: Avoid user language during auto... X-Git-Tag: 1.31.0-rc.0~1662 X-Git-Url: https://git.cyclocoop.org/%7B%7B%20url_for%28%27user%27%2C%20userid=session.user.id%29%20%7D%7D?a=commitdiff_plain;h=4be80912c8a2217344bddde64824f93d19d094db;hp=ee7ae1ce842cac612e98d1712d75a6bf59a2cf42;p=lhc%2Fweb%2Fwiklou.git Merge "CheckBlocksSecondaryAuthenticationProvider: Avoid user language during auto-creation" --- diff --git a/includes/auth/CheckBlocksSecondaryAuthenticationProvider.php b/includes/auth/CheckBlocksSecondaryAuthenticationProvider.php index f7a7ec193d..7488fbaaae 100644 --- a/includes/auth/CheckBlocksSecondaryAuthenticationProvider.php +++ b/includes/auth/CheckBlocksSecondaryAuthenticationProvider.php @@ -77,9 +77,19 @@ class CheckBlocksSecondaryAuthenticationProvider extends AbstractSecondaryAuthen public function testUserForCreation( $user, $autocreate, array $options = [] ) { $block = $user->isBlockedFromCreateAccount(); if ( $block ) { + if ( $block->mReason ) { + $reason = $block->mReason; + } else { + $msg = \Message::newFromKey( 'blockednoreason' ); + if ( !\RequestContext::getMain()->getUser()->isSafeToLoad() ) { + $msg->inContentLanguage(); + } + $reason = $msg->text(); + } + $errorParams = [ $block->getTarget(), - $block->mReason ?: \Message::newFromKey( 'blockednoreason' )->text(), + $reason, $block->getByName() ];