You are here

function tfa_block_access in Two-factor Authentication (TFA) 8

Implements hook_block_access().

File

./tfa.module, line 33
Contains tfa.module.

Code

function tfa_block_access(Block $block, $operation, AccountInterface $account) {

  // Remove access to the core user_login_block so we can replace with the TFA
  // login block.
  if (\Drupal::config('tfa.settings')
    ->get('enabled') && $block
    ->getPluginId() === 'user_login_block') {
    return AccessResult::forbidden();
  }

  // No opinion.
  return AccessResult::neutral();
}