You are here

function openid_connect_login_user in OpenID Connect / OAuth client 7

Same name and namespace in other branches
  1. 8 openid_connect.module \openid_connect_login_user()

Logs in a user.

Parameters

object $account: The user account.

string|array &$destination: The path to redirect to after login.

1 call to openid_connect_login_user()
openid_connect_complete_authorization in ./openid_connect.module
Complete the authorization after tokens have been retrieved.

File

./openid_connect.module, line 313
A pluggable client implementation for the OpenID Connect protocol.

Code

function openid_connect_login_user($account, &$destination) {
  $form_state['uid'] = $account->uid;
  $form = array();

  // TFA integration.
  if (module_exists('tfa')) {

    // The 'code' and 'state' parameters have now been used.
    unset($_GET['code'], $_GET['state']);

    // TFA will preserve the initial redirect if it is set in the $form_state.
    $form_state['redirect'] = $destination;
    tfa_login_submit($form, $form_state);
    tfa_login_form_redirect($form, $form_state);

    // TFA may want to change the redirect destination.
    if (isset($form_state['redirect']) && $form_state['redirect'] != 'user/' . $form_state['uid']) {
      $destination = $form_state['redirect'];
    }
  }
  else {
    user_login_submit($form, $form_state);
  }
}