public function LoginFirewall::isLoginAllowed in Restrict Login or Role Access by IP Address 8.4
Checks that a user is allowed to login based on IP whitelists.
Parameters
\Drupal\Core\Session\AccountInterface $account: The user to check if login is allowed.
Return value
bool Whether login is allowed or not.
Overrides LoginFirewallInterface::isLoginAllowed
1 call to LoginFirewall::isLoginAllowed()
- LoginFirewall::execute in src/
LoginFirewall.php - Checks that login is allowed, and takes appropriate action if not.
File
- src/
LoginFirewall.php, line 71
Class
- LoginFirewall
- Class LoginFirewall.
Namespace
Drupal\restrict_by_ipCode
public function isLoginAllowed(AccountInterface $account) {
if ($global = $this
->checkGlobalRestriction()) {
return TRUE;
}
if ($user = $this
->checkUserRestriction($account)) {
return TRUE;
}
// If there are no global or user restrictions set, allow login.
if ($global === NULL && $user === NULL) {
return TRUE;
}
// The global, user, or both restrictions failed, so deny.
return FALSE;
}