diff --git a/application/itopwebpage.class.inc.php b/application/itopwebpage.class.inc.php index 37590b6a3..d0a118de0 100644 --- a/application/itopwebpage.class.inc.php +++ b/application/itopwebpage.class.inc.php @@ -274,7 +274,11 @@ EOF $sOnClick = " onclick=\"this.value='';this.onclick=null;\""; } $sUserName = UserRights::GetUser(); - echo "
Logged as '$sUserName'   "; + echo "
Logged in as '$sUserName'   "; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "
\n"; echo "
\n"; echo "
\n"; diff --git a/application/loginwebpage.class.inc.php b/application/loginwebpage.class.inc.php index 29a1e33a4..32a330be0 100644 --- a/application/loginwebpage.class.inc.php +++ b/application/loginwebpage.class.inc.php @@ -62,11 +62,30 @@ h1 { $this->add("\n"); $this->add("
\n"); } + + static protected function ResetSession() + { + // 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 (isset($_COOKIE[session_name()])) + { + setcookie(session_name(), '', time()-3600, '/'); + } + // Finally, destroy the session. + session_destroy(); + } static function DoLogin() { $operation = utils::ReadParam('operation', ''); session_start(); + + if ($operation == 'logoff') + { + self::ResetSession(); + } if (!isset($_SESSION['auth_user']) || !isset($_SESSION['auth_pwd'])) { @@ -78,9 +97,9 @@ h1 { else { $oPage = new login_web_page(); - $oPage->DisplayLoginForm(); - $oPage->output(); - exit; + $oPage->DisplayLoginForm(); + $oPage->output(); + exit; } } else @@ -90,21 +109,11 @@ h1 { } if (!UserRights::Login($sAuthUser, $sAuthPwd)) { - // 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 (isset($_COOKIE[session_name()])) - { - setcookie(session_name(), '', time()-3600, '/'); - } - // Finally, destroy the session. - session_destroy(); - + self::ResetSession(); $oPage = new login_web_page(); - $oPage->DisplayLoginForm( true /* failed attempt */); - $oPage->output(); - exit; + $oPage->DisplayLoginForm( true /* failed attempt */); + $oPage->output(); + exit; } else {