You are here

function event_log_track_auth_user_login_validate in Events Log Track 8

Same name and namespace in other branches
  1. 8.2 event_log_track_auth/event_log_track_auth.module \event_log_track_auth_user_login_validate()

Implements hook_form_FORM_ID_validate().

1 string reference to 'event_log_track_auth_user_login_validate'
event_log_track_auth_form_user_login_form_alter in event_log_track_auth/event_log_track_auth.module
Implements hook_form_FORM_ID_alter().

File

event_log_track_auth/event_log_track_auth.module, line 88
Logs user authentication in the event_log_track module.

Code

function event_log_track_auth_user_login_validate($form, &$form_state) {

  // Check for erros and log them.
  $errors = $form_state
    ->getErrors();
  if (!empty($errors)) {
    $log = array(
      'type' => 'authentication',
      'operation' => 'fail',
      'description' => t('%user (pass %pass)', array(
        '%user' => $form_state
          ->getValue('name'),
        '%pass' => $form_state
          ->getValue('pass'),
      )),
      'ref_char' => $form_state
        ->getValue('name'),
    );
    event_log_track_insert($log);
  }
}