You are here

function tfa_get_code in Two-factor Authentication (TFA) 7

Same name and namespace in other branches
  1. 6 tfa.module \tfa_get_code()

Retreive sent code for user or FALSE if no code was set.

Parameters

int $uid UID of account.:

Return value

array Array of with keys (string) code, (bool) accepted , and (timestamp) created.

6 calls to tfa_get_code()
TFATestCase::testAuthentication in ./tfa.test
tfa_code_form_validate in ./tfa.pages.inc
Validate handler for TFA login form.
tfa_entry_access in ./tfa.module
Validate access to TFA code entry form.
tfa_send_code in ./tfa.module
Send the code to the user.
tfa_store_code in ./tfa.module
Store the code for state control

... See full list

File

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

Code

function tfa_get_code($uid) {
  $result = db_query("SELECT code, accepted, created FROM {tfa} WHERE uid = :uid", array(
    ':uid' => $uid,
  ))
    ->fetchAssoc();
  if (!empty($result)) {
    return $result;
  }
  return FALSE;
}