}
public function beginSecondaryAuthentication( $user, array $reqs ) {
+ // @TODO Partial blocks should not prevent the user from logging in.
+ // see: https://phabricator.wikimedia.org/T208895
if ( !$this->blockDisablesLogin ) {
return AuthenticationResponse::newAbstain();
- } elseif ( $user->isBlocked() ) {
+ } elseif ( $user->getBlock() ) {
return AuthenticationResponse::newFail(
new \Message( 'login-userblocked', [ $user->getName() ] )
);
public function testUserForCreation( $user, $autocreate, array $options = [] ) {
$block = $user->isBlockedFromCreateAccount();
if ( $block ) {
+ if ( $block->getReason() ) {
+ $reason = $block->getReason();
+ } 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()
];