Просмотр исходного кода

Log out user automatically if DEBUG_MODE is not set

Kristan Kenney 5 лет назад
Родитель
Сommit
65ec0fa231
2 измененных файлов с 10 добавлено и 3 удалено
  1. 8 1
      web/inc/main.php
  2. 2 2
      web/templates/header.html

+ 8 - 1
web/inc/main.php

@@ -146,7 +146,7 @@ function top_panel($user, $TAB) {
     $command = HESTIA_CMD."v-list-user ".escapeshellarg($user)." 'json'";
     exec ($command, $output, $return_var);
     if ( $return_var > 0 ) {
-        echo "<b>ERROR: Unable to retrieve account details.</b><br>Please log in again.";
+        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>";
         session_destroy();
         header("Location: /login/");
         exit;
@@ -154,6 +154,13 @@ function top_panel($user, $TAB) {
     $panel = json_decode(implode('', $output), true);
     unset($output);
 
+    // Log out active sessions for suspended users
+    if ($panel[$user]['SUSPENDED'] === 'yes') {
+        $_SESSION['error_msg'] = "You have been logged out. Please log in again.";
+        session_destroy();
+        header("Location: /login/");
+    }
+
     // Load user's selected theme and do not change it when impersonting user
     if ( (isset($panel[$user]['THEME'])) && (!isset($_SESSION['look']) )) {
         $_SESSION['userTheme'] = $panel[$user]['THEME'];

+ 2 - 2
web/templates/header.html

@@ -17,7 +17,7 @@
   </script>
 </head>
 
-<body class="body-<?=strtolower($TAB)?> lang-<?=$_SESSION['language']?>">
+<body class="body-<?=strtolower($TAB)?> lang-<?=$_SESSION['language']?>"><!--
   <?php if (($_SESSION['DEBUG_MODE']) == "true" ) {?>
   <?php require ''.$_SERVER['HESTIA'].'/web/templates/pages/debug_panel.html'; ?>
-  <?php } ?>
+  <?php } ?>-->