Commit 0fb7c9d4 authored by Nigel McNie's avatar Nigel McNie Committed by Nigel McNie

Moved logout stuff to one place.

parent 4d8e44e5
......@@ -204,13 +204,15 @@ function auth_setup () {
// Check the time that the session is set to log out. If the user does
// not have a session, this time will be 0.
$sessionlogouttime = $SESSION->get('logout_time');
if ($sessionlogouttime > time()) {
if ($sessionlogouttime && isset($_GET['logout'])) {
if (isset($_GET['logout'])) {
log_debug('logging user ' . $SESSION->get('username') . ' out');
$SESSION->logout();
$SESSION->add_ok_msg(get_string('loggedoutok'));
redirect(get_config('wwwroot'));
}
}
if ($sessionlogouttime > time()) {
// The session is still active, so continue it.
log_debug('session still active from previous time');
$USER = $SESSION->renew();
......@@ -218,12 +220,6 @@ function auth_setup () {
return $USER;
}
else if ($sessionlogouttime > 0) {
if (isset($_GET['logout'])) {
log_debug('logging user ' . $SESSION->get('username') . ' out');
$SESSION->logout();
$SESSION->add_ok_msg(get_string('loggedoutok'));
redirect(get_config('wwwroot'));
}
// The session timed out
log_debug('session timed out');
$SESSION->logout();
......
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