mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-19 15:22:17 +02:00
Added a logoff button
SVN:code[124]
This commit is contained in:
@@ -274,7 +274,11 @@ EOF
|
|||||||
$sOnClick = " onclick=\"this.value='';this.onclick=null;\"";
|
$sOnClick = " onclick=\"this.value='';this.onclick=null;\"";
|
||||||
}
|
}
|
||||||
$sUserName = UserRights::GetUser();
|
$sUserName = UserRights::GetUser();
|
||||||
echo "<div id=\"OrganizationSelection\" style=\"position:absolute; top:18px; right:16px; width:400px;\">Logged as '$sUserName' ";
|
echo "<div id=\"OrganizationSelection\" style=\"position:absolute; top:18px; right:16px; width:400px;\">Logged in as '$sUserName' ";
|
||||||
|
echo "<form action=\"../pages/UI.php\" method=\"post\" style=\"display:inline\">\n";
|
||||||
|
echo "<input type=\"Submit\" value=\"Log off\">\n";
|
||||||
|
echo "<input type=\"hidden\" name=\"operation\" value=\"logoff\">\n";
|
||||||
|
echo "</form>\n";
|
||||||
echo "<form action=\"../pages/UI.php\" style=\"display:inline\"><div style=\"padding:1px; background-color:#fff;display:inline;\"><img src=\"../images/magnifier.gif\"/><input style=\"border:0\" type=\"text\" size=\"15\" title=\"Global Search\" name=\"text\" value=\"$sText\"$sOnClick></input></div><input type=\"Submit\" value=\"Search\">
|
echo "<form action=\"../pages/UI.php\" style=\"display:inline\"><div style=\"padding:1px; background-color:#fff;display:inline;\"><img src=\"../images/magnifier.gif\"/><input style=\"border:0\" type=\"text\" size=\"15\" title=\"Global Search\" name=\"text\" value=\"$sText\"$sOnClick></input></div><input type=\"Submit\" value=\"Search\">
|
||||||
<input type=\"hidden\" name=\"operation\" value=\"full_text\"></form>\n";
|
<input type=\"hidden\" name=\"operation\" value=\"full_text\"></form>\n";
|
||||||
echo "</div>\n";
|
echo "</div>\n";
|
||||||
|
|||||||
@@ -63,11 +63,30 @@ h1 {
|
|||||||
$this->add("</div>\n");
|
$this->add("</div>\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()
|
static function DoLogin()
|
||||||
{
|
{
|
||||||
$operation = utils::ReadParam('operation', '');
|
$operation = utils::ReadParam('operation', '');
|
||||||
session_start();
|
session_start();
|
||||||
|
|
||||||
|
if ($operation == 'logoff')
|
||||||
|
{
|
||||||
|
self::ResetSession();
|
||||||
|
}
|
||||||
|
|
||||||
if (!isset($_SESSION['auth_user']) || !isset($_SESSION['auth_pwd']))
|
if (!isset($_SESSION['auth_user']) || !isset($_SESSION['auth_pwd']))
|
||||||
{
|
{
|
||||||
if ($operation == 'login')
|
if ($operation == 'login')
|
||||||
@@ -78,9 +97,9 @@ h1 {
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$oPage = new login_web_page();
|
$oPage = new login_web_page();
|
||||||
$oPage->DisplayLoginForm();
|
$oPage->DisplayLoginForm();
|
||||||
$oPage->output();
|
$oPage->output();
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -90,21 +109,11 @@ h1 {
|
|||||||
}
|
}
|
||||||
if (!UserRights::Login($sAuthUser, $sAuthPwd))
|
if (!UserRights::Login($sAuthUser, $sAuthPwd))
|
||||||
{
|
{
|
||||||
// Unset all of the session variables.
|
self::ResetSession();
|
||||||
$_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();
|
|
||||||
|
|
||||||
$oPage = new login_web_page();
|
$oPage = new login_web_page();
|
||||||
$oPage->DisplayLoginForm( true /* failed attempt */);
|
$oPage->DisplayLoginForm( true /* failed attempt */);
|
||||||
$oPage->output();
|
$oPage->output();
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user