function user_login_finalize

Same name and namespace in other branches
  1. 11.x core/modules/user/user.module \user_login_finalize()
  2. 10 core/modules/user/user.module \user_login_finalize()
  3. 9 core/modules/user/user.module \user_login_finalize()
  4. 8.9.x core/modules/user/user.module \user_login_finalize()
  5. 7.x modules/user/user.module \user_login_finalize()

Finalizes the login process and logs in a user.

The function logs in the user, records a watchdog message about the new session, saves the login timestamp, calls hook_user_login(), and generates a new session.

The current user is replaced with the passed in account.

Parameters

\Drupal\user\UserInterface $account: The account to log in.

Deprecated

in drupal:11.5.0 and is removed from drupal:13.0.0. Use \Drupal\user\LoginFinalizer::finalizeLogin() instead.

See also

https://www.drupal.org/node/3379194

\Drupal\user\Authentication\Provider\Cookie

hook_user_login()

1 call to user_login_finalize()
RestAuthenticationController::userLoginFinalize in core/modules/rest/src/Controller/RestAuthenticationController.php
Finalizes the user login.

File

core/modules/user/user.module, line 97

Code

function user_login_finalize(UserInterface $account) : void {
  @trigger_error(__FUNCTION__ . '() is deprecated in drupal:11.5.0 and is removed from drupal:13.0.0. Use \\Drupal\\user\\LoginFinalizer::finalizeLogin() instead. See https://www.drupal.org/node/3379194', E_USER_DEPRECATED);
  \Drupal::service(LoginFinalizer::class)->finalizeLogin($account);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.