Commit e320e6a4 authored by lkmorlan's avatar lkmorlan

RT-Ticket: #233654

Simplify the uw_security_user_logout() to take advantage of new feature in CAS 7.x-1.2.
parent 8c597695
......@@ -23,52 +23,13 @@ function uw_security_form_alter(&$form, &$form_state, $form_id) {
* Implements hook_user_logout().
*
* All Drupal logouts also logout from CAS.
* This code is identical to cas.module/cas_logout() except for a few lines commented out because this functionality has been done already in user_logout().
*/
function uw_security_user_logout($account) {
// Unused.
//global $user;
// Build the logout URL.
cas_phpcas_init();
$logout_url = phpCAS::getServerLogoutURL();
$options = array();
if (isset($_GET['destination']) && !url_is_external($_GET['destination'])) {
// Add destination override so that a destination can be specified on the
// logout link, e.g., caslogout?desination=http://foo.bar.com/foobar. We do
// not allow absolute URLs to be passed via $_GET, as this can be an attack
// vector.
$destination = $_GET['destination'];
}
else {
$destination = variable_get('cas_logout_destination', '');
}
// Make it an absolute url. This will also convert <front> to the front page.
// Always set destination to better mimic user_logout().
//if ($destination) {
$destination_url = url($destination, array('absolute' => TRUE));
$options['query'] = array(
'destination' => $destination_url,
'service' => $destination_url,
'url' => $destination_url,
);
///}
// Mimic user_logout().
// Next 2 lines already run in user_logout().
//watchdog('user', 'Session closed for %name.', array('%name' => $user->name));
//module_invoke_all('user_logout', $user);
session_destroy();
// Force redirection in drupal_goto().
unset($_GET['destination']);
drupal_goto($logout_url, $options);
cas_logout(FALSE);
}
/**
* hook_module_implements_alter().
* Implements hook_module_implements_alter().
*
* Make uw_security_user_logout() be the last implementation of this hook to run.
*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment