You are here

function logintoboggan_process_login in LoginToboggan 5

Same name and namespace in other branches
  1. 8 logintoboggan.module \logintoboggan_process_login()
  2. 6 logintoboggan.module \logintoboggan_process_login()
  3. 7 logintoboggan.module \logintoboggan_process_login()

Actually log the user on

Parameters

object $account: The user object.

array $edit: An array of form values if a form has been submitted.

string $redirect: A string describing a redirect location, in the form that drupal_goto() will understand. Defaults to: 'user/'. $user->uid

2 calls to logintoboggan_process_login()
logintoboggan_user_register_submit in ./logintoboggan.module
Custom submit function for user registration form
logintoboggan_validate_email in ./logintoboggan.module
Menu callback; process validate the e-mail address as a one time URL, and redirects to the user page on success.

File

./logintoboggan.module, line 928
Logintoboggan Module

Code

function logintoboggan_process_login($account, $edit, $redirect = '') {
  global $user;
  $user = user_load(array(
    'uid' => $account->uid,
  ));

  // User has new permissions, so we clear their menu cache.
  cache_clear_all($user->uid . ':', 'cache_menu', TRUE);

  // Call core's submit handler manually.
  user_login_submit(array(), $edit);

  // In the special case where a user is validating but they did not create their
  // own password, redirect them to the user edit page, with a final destination
  // of the confirmation page, if it exists.
  if (variable_get('user_email_verification', TRUE)) {
    watchdog('user', t('User %name used one-time login link at time %timestamp.', array(
      '%name' => $user->name,
      '%timestamp' => time(),
    )));
    drupal_set_message(t('You have just used your one-time login link. It is no longer possible to use this link to login. Please change your password.'));
    $destination = $redirect ? "destination={$redirect}" : NULL;
    drupal_goto('user/' . $user->uid . '/edit', $destination);
  }
  if ($redirect != '') {
    return $redirect;
  }
  return 'user/' . $user->uid;
}