You are here

function hook_tfa_api in Two-factor Authentication (TFA) 6

Same name and namespace in other branches
  1. 7.2 tfa.api.php \hook_tfa_api()
  2. 7 tfa.api.php \hook_tfa_api()

Define TFA communication channel and address storage.

This hook is required to provide a TFA channel for login code communication or to provide custom storage of a address (e.g. phone number) for an account.

Return value

An array of information about the module's methods for TFA integration.

Required attributes are:

  • 'title' Human-readable title of the communication channel.
  • 'send callback' Function to call for login code transfer. Arguments are $account (a fully loaded user object being authenticated), $code (the login code, string), $message (message to accompany code, string). Must return boolean TRUE or FALSE.
  • 'address callback' Function to call for a unique address for the account being authenticated. Arguments are $account, a fully loaded user object. Must return a non-empty variable or FALSE.
1 function implements hook_tfa_api()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

sms_tfa_api in ./tfa.module
Implements hook_tfa_api() on behalf of the SMS module.

File

./tfa.api.php, line 40
This file contains no working PHP code; it exists to provide additional documentation for doxygen as well as to document hooks in the standard Drupal manner.

Code

function hook_tfa_api() {
  return array(
    'title' => t('TFA Example Channel'),
    'send callback' => '_tfa_send_code',
    'address callback' => '_tfa_lookup_address',
  );
}