You are here

function cas_server_login in CAS 5.4

Same name and namespace in other branches
  1. 5.3 cas_server.module \cas_server_login()
  2. 6.3 cas_server.module \cas_server_login()
  3. 6.2 cas_server.module \cas_server_login()
  4. 7 cas_server.module \cas_server_login()

Handle login

1 string reference to 'cas_server_login'
cas_server_menu in ./cas_server.module
Implementation of hook_menu

File

./cas_server.module, line 63
Provides a protocol compliant version of CAS server 2.x

Code

function cas_server_login() {

  // Set login cookie so that we know we're in the process of logging in
  global $user;
  if ($user->uid) {
    if ($_GET['service']) {
      $_COOKIE[CAS_LOGIN_COOKIE] = $_REQUEST['service'];
    }
    $output = t('You have successfully logged into CAS');
    cas_server_service_return();
  }
  else {
    if ($_GET['gateway'] && $_GET['service']) {
      drupal_goto($_GET['service']);
    }
    else {

      // Redirect to user login
      if ($_GET['service']) {
        setcookie(CAS_LOGIN_COOKIE, $_REQUEST['service']);
      }
      $output .= l('Login', 'user', array(
        'query' => 'destination=cas/login',
      ));
      drupal_goto('user', 'destination=cas/login');
    }
  }
  return $output;
}