You are here

function logintoboggan_process_login in LoginToboggan 8

Same name and namespace in other branches
  1. 5 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.

object $redirect: Redirect path components.

1 call to logintoboggan_process_login()
LogintobogganController::logintobogganValidateEmail in src/Controller/LogintobogganController.php
This will return the output of the page.

File

./logintoboggan.module, line 321
LoginToboggan module.

Code

function logintoboggan_process_login($account, $redirect) {
  user_login_finalize($account);

  // In the case where a user is validating but they did not create their
  // own password, show message letting them know to change their password.
  if (\Drupal::config('user.settings')
    ->get('verify_mail')) {
    $request_time = \Drupal::time()
      ->getRequestTime();
    \Drupal::logger('user')
      ->notice('User %name used one-time login link at time %timestamp.', [
      '%name' => $account
        ->getUsername(),
      '%timestamp' => $request_time,
    ]);
    \Drupal::messenger()
      ->addMessage(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.'), 'status');
  }
  if (!empty($redirect)) {
    return $redirect;
  }
  return Url::fromRoute('user.edit', [
    'user' => $account
      ->id(),
  ]);
}