Skip to content

Commit

Permalink
Fix #2927. Don't issue a login link if user is blocked. (#4934)
Browse files Browse the repository at this point in the history
* Fix #2927. Don't issue a login link if user is blocked.

* Add name in err msg
  • Loading branch information
weitzman committed Dec 15, 2021
1 parent ef31e7d commit cb2434e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Commands/core/LoginCommands.php
Expand Up @@ -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',
Expand Down

0 comments on commit cb2434e

Please sign in to comment.