function cas_server_login in CAS 6.3
Same name and namespace in other branches
- 5.4 cas_server.module \cas_server_login()
- 5.3 cas_server.module \cas_server_login()
- 6.2 cas_server.module \cas_server_login()
- 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 104 - 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;
$output = '';
$service = isset($_REQUEST['service']) ? $_REQUEST['service'] : '';
$gateway = isset($_REQUEST['gateway']);
if ($user->uid) {
if ($service) {
$_COOKIE[CAS_LOGIN_COOKIE] = $service;
}
$output = t('You have successfully logged into CAS');
cas_server_service_return();
}
else {
if ($gateway && $service) {
drupal_goto($service);
}
else {
// Redirect to user login
if ($service) {
setcookie(CAS_LOGIN_COOKIE, $service);
}
$output .= l(t('Login'), 'user', array(
'query' => 'destination=cas/login',
));
drupal_goto('user', 'destination=cas/login');
}
}
return $output;
}