Skip to content

Commit

Permalink
Added the ability to log out
Browse files Browse the repository at this point in the history
Requested by Evelyn and Melissa of MIIS.
  • Loading branch information
adamfranco committed May 20, 2015
1 parent 68563b0 commit 9abf223
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 2 deletions.
1 change: 1 addition & 0 deletions go.php
Expand Up @@ -25,6 +25,7 @@
"gotionary.php",
"gobacktionary.php",
"login.php",
"logout.php",
"go_functions.php",
"process.php",
"all_codes.php",
Expand Down
2 changes: 1 addition & 1 deletion header_midd.php
Expand Up @@ -93,8 +93,8 @@
print "<a href='login.php?r=".urlencode(curPageURL())."'>Log in</a>";
}
} else {
//print "<a href='https://login.middlebury.edu/cas/logout'>Log Out</a>";
print "<a href='admin.php'>Manage GO</a>";
print " | <a href='logout.php'>Log Out</a>";
}
?>
</section>
Expand Down
2 changes: 1 addition & 1 deletion header_miis.php
Expand Up @@ -209,8 +209,8 @@
print "<a href='login.php?r=".urlencode(curPageURL())."'>Log in</a>";
}
} else {
//print "<a href='https://login.middlebury.edu/cas/logout'>Log Out</a>";
print "<a href='admin.php'>Manage GO</a>";
print " | <a href='logout.php'>Log Out</a>";
}
?>
</nav>
Expand Down
28 changes: 28 additions & 0 deletions logout.php
@@ -0,0 +1,28 @@
<?php

require_once "config.php";
require_once "go.php";

// Unset all of the session variables.
$_SESSION = array();
// If it's desired to kill the session, also delete the session cookie.
// Note: This will destroy the session, and not just the session data!
if (ini_get("session.use_cookies")) {
$params = session_get_cookie_params();
setcookie(session_name(), '', time() - 42000,
$params["path"], $params["domain"],
$params["secure"], $params["httponly"]
);
}
session_destroy();

$dest = $institutions[$institution]['base_uri'];

if (AUTH_METHOD == 'cas') {
GoAuthCas::configurePhpCas();
phpCAS::logoutWithRedirectServiceAndUrl($dest, $dest);
}

//redirect on completion
header("location: ".$dest);
exit;

0 comments on commit 9abf223

Please sign in to comment.