logout via POST

This commit is contained in:
Steve Beaver 2017-02-10 17:07:48 -05:00
parent 4b72f68fd9
commit ce437697cd
2 changed files with 6 additions and 6 deletions

View File

@ -1779,7 +1779,7 @@ function session_auth() {
if (!isset($config['system']['webgui']['session_timeout'])) {
/* Default to 4 hour timeout if one is not set */
if ($_SESSION['last_access'] < (time() - 14400)) {
$_GET['logout'] = true;
$_POST['logout'] = true;
$_SESSION['Logout'] = true;
} else {
$_SESSION['last_access'] = time();
@ -1792,7 +1792,7 @@ function session_auth() {
} else {
/* Check for stale session */
if ($_SESSION['last_access'] < (time() - ($config['system']['webgui']['session_timeout'] * 60))) {
$_GET['logout'] = true;
$_POST['logout'] = true;
$_SESSION['Logout'] = true;
} else {
/* only update if it wasn't ajax */
@ -1803,7 +1803,7 @@ function session_auth() {
}
/* user hit the logout button */
if (isset($_GET['logout'])) {
if (isset($_POST['logout'])) {
if ($_SESSION['Logout']) {
log_error(sprintf(gettext("Session timed out for user '%1\$s' from: %2\$s"), $_SESSION['Username'], $_SERVER['REMOTE_ADDR']));

View File

@ -207,7 +207,7 @@ function output_menu($arrayitem, $target = null, $section = "") {
if ($item[0] == '-DIVIDER-') {
$output .= ' <li class="divider"></li>';
} else {
$output .= "<li>". sprintf("<a %s>%s</a>", $attr, $item[0]) . "</li>\n";
$output .= "<li>". sprintf("<a %s %s>%s</a>", $attr, ($item[1] == "/index.php?logout") ? "usepost":"",$item[0]) . "</li>\n";
}
}
}
@ -505,7 +505,7 @@ if (are_notices_pending()) {
endif;
?>
<li class="dropdown">
<a href="/index.php?logout">
<a href="/index.php?logout" usepost>
<i class="fa fa-sign-out" title="<?=gettext("Logout") . " (" . $_SESSION['Username'] . "@" . htmlspecialchars($system_url) . ")"?>"></i>
</a>
</li>
@ -524,7 +524,7 @@ if (are_notices_pending()) {
unset($notitle);
} else {
if (isset($pglinks)) {
print(genhtmltitle($pgtitle, $pglinks));
print(genhtmltitle($pgtitle, $pglinks));
} else {
print(genhtmltitle($pgtitle));
}