From 5c4389e300e9ac6163cb1dc1ebceedc44167a362 Mon Sep 17 00:00:00 2001 From: Moshe Weitzman Date: Wed, 15 Dec 2021 08:16:12 -0500 Subject: [PATCH] Fix #2927. Don't issue a login link if user is blocked. --- src/Commands/core/LoginCommands.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Commands/core/LoginCommands.php b/src/Commands/core/LoginCommands.php index 887bf87400..04c34ed513 100644 --- a/src/Commands/core/LoginCommands.php +++ b/src/Commands/core/LoginCommands.php @@ -69,6 +69,10 @@ public function login($path = '', $options = ['name' => null, 'uid' => null, 'ma $account = User::load(1); } + if ($account->isBlocked()) { + throw new \InvalidArgumentException(dt('Account !name is blocked and thus cannot login. The user:unblock command may be helpful.')); + } + $timestamp = \Drupal::time()->getRequestTime(); $link = Url::fromRoute( 'user.reset.login',