You are here

function lhfingerprintjs2_form_alter in Login History 7

Implements hook_form_alter().

File

lhfingerprintjs2/lhfingerprintjs2.module, line 62
fingerprintjs2 support for the Login History module.

Code

function lhfingerprintjs2_form_alter(&$form, &$form_state, $form_id) {
  switch ($form_id) {

    // Password form data is not sent to hook_user_login. This extra submit
    // function will put the data into $_SESSION so it's available later.
    case 'user_pass_reset':
      $form['#submit'][] = 'lhfingerprintjs_password_reset_storage';

    // Intentionally fall through to the rest of the form altering.
    case 'user_login_block':
    case 'user_login':
    case 'user_register_form':

      // A field to hold the fingerprint data.
      $form['lhfingerprintjs'] = array(
        '#type' => 'hidden',
        '#default_value' => '',
      );

      // What in the world would we do without our libraries?
      $form['lhfingerprintjs']['#attached']['library'][] = array(
        'lhfingerprintjs2',
        'fingerprintjs2',
      );
      break;
  }
}