You are here

function bakery_user_authenticate_finalize in Bakery Single Sign-On System 7.2

Same name and namespace in other branches
  1. 6.2 bakery.module \bakery_user_authenticate_finalize()
  2. 6 bakery.module \bakery_user_authenticate_finalize()
  3. 7.4 bakery.module \bakery_user_authenticate_finalize()
  4. 7.3 bakery.module \bakery_user_authenticate_finalize()

Finalize the login process. Must be called when logging in a user.

The function records a watchdog message about the new session, saves the login timestamp, calls hook_user op 'login' and generates a new session.

$param $edit This array is passed to hook_user op login.

2 calls to bakery_user_authenticate_finalize()
bakery_login in ./bakery.module
Special Bakery login callback authenticates the user and returns to slave.
bakery_user_external_login in ./bakery.module
Perform standard Drupal login operations for a user object.

File

./bakery.module, line 1738
Module file for the Bakery.

Code

function bakery_user_authenticate_finalize(&$edit) {
  global $user;
  watchdog('user', 'Session opened for %name.', array(
    '%name' => $user->name,
  ));

  // Update the user table timestamp noting user has logged in.
  // This is also used to invalidate one-time login links.
  $user->login = time();
  db_update('users')
    ->fields(array(
    'login' => $user->login,
  ))
    ->condition('uid', $user->uid, '=')
    ->execute();

  // Regenerate the session ID to prevent against session fixation attacks.
  drupal_session_regenerate();
  user_module_invoke('login', $edit, $user);
}