function system_login_form_submit

6.x system.module system_login_form_submit($form, &$form_state)
4.x system.module system_login_form_submit($form, &$form_state)
5.x system.module system_login_form_submit($form, &$form_state)

Submit handler for login form. If we are here, it probably means we have indeed authenticated. Just in case, we will test the form_state["passed_authentication"] value, which we expect to have been set in our validate handler.

We will now proceed to actually log the user into the system.

File

modules/system/system.module, line 1635

Code

function system_login_form_submit($form, &$form_state) {
  $user = $form_state ["values"]["user"];
  $password = $form_state ["value"]["password"];
  $passed = $form_state ["passed_authentication"];
  $db_row = $form_state ["db_row"];

  if (!$passed) {
    fp_add_message(t("Sorry, there has been an error while trying to authenticate the user."));
    return;
  }


  $_SESSION ["fp_logged_in"] = TRUE;


  // Set up a new $account object.
  $account = new stdClass();

  $account = fp_load_user($db_row ["user_id"]);
  // Okay, let's look for all the modules who have implimented hook_user_login
  $modules = modules_implement_hook("user_login");
  foreach ($modules as $module) {
    call_user_func_array($module . '_user_login', array(&$account));
  }

  // Set the $account to the SESSION.
  $_SESSION ["fp_user_object"] = $account;

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

  fp_goto("<front>");

}