You are here

function _tfa_logout in Two-factor Authentication (TFA) 7

Same name and namespace in other branches
  1. 6 tfa.module \_tfa_logout()

Logout 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 111
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();
}