You are here

function _cas_redirect_after_login in CAS 7

Redirect a user after they have logged into the website through CAS

Parameters

$cas_first_login - TRUE if this is the first time the CAS user: logged into the site

1 call to _cas_redirect_after_login()
cas_login_check in ./cas.module
Checks to see if the user needs to be logged in.

File

./cas.module, line 1362
Enables users to authenticate via a Central Authentication Service (CAS) Cas will currently work if the auto registration is turned on and will create user accounts automatically.

Code

function _cas_redirect_after_login($cas_first_login) {

  // When users first log in, we may want to redirect them to a special page if specified
  if ($cas_first_login && variable_get('cas_first_login_destination', '')) {
    $destination = variable_get('cas_first_login_destination', '');
    drupal_goto($destination);
  }
  else {

    // If logged in through forced authentication ('/cas'), then redirect user to the
    // homepage, or to wherever the current "destination" parameter points.
    if (strtolower(current_path()) == 'cas') {
      drupal_goto('');
    }
    else {
      drupal_goto(current_path(), array(
        'query' => drupal_get_query_parameters(),
      ));
    }
  }
}