You are here

function tfa_logout in Two-factor Authentication (TFA) 7.2

Unauthenticate the user. Similar to user_logout() but doesn't redirect.

1 call to tfa_logout()
tfa_user_login in ./tfa.module
Implements hook_user_login().

File

./tfa.module, line 399
Two-factor authentication for Drupal.

Code

function tfa_logout() {
  global $user;
  watchdog('tfa', 'Session closed for %name.', array(
    '%name' => $user->name,
  ));
  module_invoke_all('user_logout', $user);

  // Destroy the current session, and reset $user to the anonymous user.
  session_destroy();

  // Force anonymous user.
  $user = drupal_anonymous_user();
}