Skip to content

Commit 65ec0fa

Browse files
author
Kristan Kenney
committed
Log out user automatically if DEBUG_MODE is not set
1 parent 2e0c4dc commit 65ec0fa

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

web/inc/main.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,14 +146,21 @@ function top_panel($user, $TAB) {
146146
$command = HESTIA_CMD."v-list-user ".escapeshellarg($user)." 'json'";
147147
exec ($command, $output, $return_var);
148148
if ( $return_var > 0 ) {
149-
echo "<b>ERROR: Unable to retrieve account details.</b><br>Please log in again.";
149+
echo "<span style='font-size: 18px;'><b>ERROR: Unable to retrieve account details.</b><br>Please <b><a href='/login/'>log in</a></b> again.</span>";
150150
session_destroy();
151151
header("Location: /login/");
152152
exit;
153153
}
154154
$panel = json_decode(implode('', $output), true);
155155
unset($output);
156156

157+
// Log out active sessions for suspended users
158+
if ($panel[$user]['SUSPENDED'] === 'yes') {
159+
$_SESSION['error_msg'] = "You have been logged out. Please log in again.";
160+
session_destroy();
161+
header("Location: /login/");
162+
}
163+
157164
// Load user's selected theme and do not change it when impersonting user
158165
if ( (isset($panel[$user]['THEME'])) && (!isset($_SESSION['look']) )) {
159166
$_SESSION['userTheme'] = $panel[$user]['THEME'];

web/templates/header.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
</script>
1818
</head>
1919

20-
<body class="body-<?=strtolower($TAB)?> lang-<?=$_SESSION['language']?>">
20+
<body class="body-<?=strtolower($TAB)?> lang-<?=$_SESSION['language']?>"><!--
2121
<?php if (($_SESSION['DEBUG_MODE']) == "true" ) {?>
2222
<?php require ''.$_SERVER['HESTIA'].'/web/templates/pages/debug_panel.html'; ?>
23-
<?php } ?>
23+
<?php } ?>-->

0 commit comments

Comments
 (0)