function system_mfa_login_form_submit

7.x system.module system_mfa_login_form_submit($form, $form_state)
6.x system.module system_mfa_login_form_submit($form, $form_state)

File

modules/system/system.module, line 3302

Code

function system_mfa_login_form_submit($form, $form_state) {
  // If we made it here, the user is allowed to log in.

  $db_row = $_SESSION ['mfa__form_state_db_row'];

  $user_id = $db_row ['user_id'];

  $mfa_remember = intval($form_state ['values']['mfa_remember']);
  // If we should remember for 30 days, then set cookie.
  if ($mfa_remember == TRUE) {
    setcookie("flightpath_mfa_remember__" . $user_id, "yes", strtotime("NOW + 30 DAYS"));
  }
  else {
    // Clear the cookie
    setcookie("flightpath_mfa_remember__" . $user_id, "no", 1);
  }


  // Actually log in the user.
  $account = system_perform_user_login($user_id);

  // Watchdog
  watchdog("mfa-login", "@user has logged in via mfa. CWID: @cwid", array("@user" => "$account->name ($account->id)", "@cwid" => $account->cwid));

  fp_goto("<front>");


}