You are here

function tfa_login_allowed in Two-factor Authentication (TFA) 7.2

Check TFA plugins if login should be interrupted for authenticating account.

Parameters

object $account: User account.

Return value

bool Whether login is allowed.

2 calls to tfa_login_allowed()
tfa_login_submit in ./tfa.module
Login submit handler to determine if TFA process is applicable.
tfa_user_login in ./tfa.module
Implements hook_user_login().

File

./tfa.module, line 331
Two-factor authentication for Drupal.

Code

function tfa_login_allowed($account) {

  // TFA master login allowed switch is set by tfa_login().
  if (isset($_SESSION['tfa'][$account->uid]['login']) && $_SESSION['tfa'][$account->uid]['login'] === TRUE) {
    return TRUE;
  }

  // Else check if login plugins will specifically allow login.
  $tfa = tfa_get_process($account);
  return $tfa
    ->loginAllowed() === TRUE;
}