From cb2434e319967f65a1f4dee2dcdb68f5c097336b Mon Sep 17 00:00:00 2001 From: Moshe Weitzman Date: Wed, 15 Dec 2021 08:52:33 -0500 Subject: [PATCH] Fix #2927. Don't issue a login link if user is blocked. (#4934) * Fix #2927. Don't issue a login link if user is blocked. * Add name in err msg --- 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..3db35557ba 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.', ['!name' => $account->getAccountName()])); + } + $timestamp = \Drupal::time()->getRequestTime(); $link = Url::fromRoute( 'user.reset.login',