You are here

function ga_login_create_form in Google Authenticator login 6

Same name and namespace in other branches
  1. 7 ga_login.pages.inc \ga_login_create_form()
1 string reference to 'ga_login_create_form'
ga_login_menu in ./ga_login.module
Implementation of hook_menu().

File

./ga_login.module, line 45

Code

function ga_login_create_form() {
  $result = db_query("SELECT uid, name FROM {users}");
  while ($account = db_fetch_object($result)) {
    $options[$account->uid] = check_plain($account->name);
  }
  $form['info'] = array(
    '#type' => 'markup',
    '#value' => '<p>' . t('Everytime you use this form a new key will be generated!') . '</p>',
  );
  $form['uid'] = array(
    '#title' => t('User'),
    '#type' => 'select',
    '#options' => $options,
    '#required' => TRUE,
  );
  $form['tokentype'] = array(
    '#title' => t('Code type'),
    '#type' => 'select',
    '#options' => array(
      'TOTP' => t('Time-based code'),
      'HOTP' => t('Counter-based code'),
    ),
    '#default_value' => 'TOTP',
    '#required' => TRUE,
    '#description' => t('Select the type of code you want to create.'),
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Create code'),
  );
  return $form;
}