You are here

function tfa_basic_get_tfa_data in TFA Basic plugins 7

Get TFA data for an account.

array(
  'status' => TRUE,
  'data' => array(
    'primary' => 'app',
    'sms' => FALSE,
  ),
);

Parameters

object $account: User account.

Return value

array TFA data.

5 calls to tfa_basic_get_tfa_data()
TfaBasicSms::ready in includes/tfa_sms.inc
Determine if the plugin can run for the current TFA context.
tfa_basic_overview in ./tfa_basic.pages.inc
TFA Basic account setup overview page.
tfa_basic_setup_form in ./tfa_basic.pages.inc
TFA setup form router.
tfa_basic_setup_save_data in ./tfa_basic.module
Save TFA settings for an account.
tfa_basic_tfa_context_alter in ./tfa_basic.module
Alters tfa_context array to set plugins from user settings.

File

./tfa_basic.module, line 397

Code

function tfa_basic_get_tfa_data($account) {
  $result = db_query("SELECT status, saved, data FROM {tfa_user_settings} WHERE uid = :uid", array(
    ':uid' => $account->uid,
  ))
    ->fetchAssoc();
  if (!empty($result)) {
    $data = array();
    if (!empty($result['data'])) {
      $data = json_decode($result['data'], TRUE);
    }
    $tfa = array(
      'status' => $result['status'] == '1' ? TRUE : FALSE,
      'saved' => $result['saved'],
      'data' => $data,
    );
    return $tfa;
  }
  return array();
}