You are here

function tfa_ready in Two-factor Authentication (TFA) 6

Same name and namespace in other branches
  1. 7 tfa.module \tfa_ready()

Determine if TFA is properly configured and setup for an account.

2 calls to tfa_ready()
tfa_admin_settings in ./tfa.pages.inc
Admin settings form.
tfa_user in ./tfa.module
Implements hook_user().

File

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

Code

function tfa_ready($account) {
  $module = variable_get('tfa_channel', 'sms');
  $function = $module . '_tfa_api';

  // Verify channel is setup.
  if (empty($module) || !function_exists($function)) {
    return FALSE;
  }
  $channel = $function();

  // Verify there is an address (phone or other method) for this account.
  $function = $channel['address callback'];
  if (!function_exists($function)) {
    return FALSE;
  }
  $address = $function($account);
  if (empty($address)) {
    return FALSE;
  }
  return TRUE;
}