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

Add POLICY_SYSTEM_RESET_PASSWORD

Kristan Kenney 5 лет назад
Родитель
Сommit
583f34e024

+ 1 - 0
bin/v-list-sys-config

@@ -77,6 +77,7 @@ json_list() {
         "API_ALLOWED_IP": "'$API_ALLOWED_IP'",
         "POLICY_SYSTEM_PROTECTED_ADMIN": "'$POLICY_SYSTEM_PROTECTED_ADMIN'",
         "POLICY_SYSTEM_HIDE_ADMIN": "'$POLICY_SYSTEM_HIDE_ADMIN'",
+        "POLICY_SYSTEM_PASSWORD_RESET": "'$POLICY_SYSTEM_PASSWORD_RESET'",
         "POLICY_USER_EDIT_DETAILS": "'$POLICY_USER_EDIT_DETAILS'",
         "POLICY_USER_DELETE_LOGS": "'$POLICY_USER_DELETE_LOGS'",
         "POLICY_USER_VIEW_LOGS": "'$POLICY_USER_VIEW_LOGS'",

+ 1 - 1
web/css/src/themes/default.css

@@ -3307,7 +3307,7 @@ a.button.cancel {
   letter-spacing: -0.01em;
   border-bottom: 1px solid #ccc;
   cursor: pointer;
-  min-width: 379px;
+  min-width: 390px;
 }
 
 .section-hide-button {

Разница между файлами не показана из-за своего большого размера
+ 0 - 0
web/css/themes/default.min.css


+ 17 - 6
web/edit/server/index.php

@@ -701,7 +701,7 @@ if (!empty($_POST['save'])) {
             exec (HESTIA_CMD."v-change-sys-config-value POLICY_USER_EDIT_DETAILS ".escapeshellarg($_POST['v_policy_user_edit_details']), $output, $return_var);
             check_return_code($return_var,$output);
             unset($output);
-            if (empty($_SESSION['error_msg'])) $v_enforce_subdomain_ownership = $_POST['v_policy_user_edit_details'];
+            if (empty($_SESSION['error_msg'])) $v_policy_user_edit_details = $_POST['v_policy_user_edit_details'];
             $v_security_adv = 'yes';
         }
     }
@@ -712,7 +712,7 @@ if (!empty($_POST['save'])) {
             exec (HESTIA_CMD."v-change-sys-config-value POLICY_USER_VIEW_LOGS ".escapeshellarg($_POST['v_policy_user_view_logs']), $output, $return_var);
             check_return_code($return_var,$output);
             unset($output);
-            if (empty($_SESSION['error_msg'])) $v_enforce_subdomain_ownership = $_POST['v_policy_user_view_logs'];
+            if (empty($_SESSION['error_msg'])) $v_policy_user_view_logs = $_POST['v_policy_user_view_logs'];
             $v_security_adv = 'yes';
         }
     }
@@ -723,7 +723,18 @@ if (!empty($_POST['save'])) {
             exec (HESTIA_CMD."v-change-sys-config-value POLICY_USER_DELETE_LOGS ".escapeshellarg($_POST['v_policy_user_delete_logs']), $output, $return_var);
             check_return_code($return_var,$output);
             unset($output);
-            if (empty($_SESSION['error_msg'])) $v_enforce_subdomain_ownership = $_POST['v_policy_user_delete_logs'];
+            if (empty($_SESSION['error_msg'])) $v_policy_user_delete_logs = $_POST['v_policy_user_delete_logs'];
+            $v_security_adv = 'yes';
+        }
+    }
+
+    // Change POLICY_SYSTEM_PASSWORD_RESET
+    if (empty($_SESSION['error_msg'])) {
+        if ($_POST['v_policy_system_password_reset'] != $_SESSION['POLICY_SYSTEM_PASSWORD_RESET']) {
+            exec (HESTIA_CMD."v-change-sys-config-value POLICY_SYSTEM_PASSWORD_RESET ".escapeshellarg($_POST['v_policy_system_password_reset']), $output, $return_var);
+            check_return_code($return_var,$output);
+            unset($output);
+            if (empty($_SESSION['error_msg'])) $v_policy_system_password_reset = $_POST['v_policy_system_password_reset'];
             $v_security_adv = 'yes';
         }
     }
@@ -734,7 +745,7 @@ if (!empty($_POST['save'])) {
             exec (HESTIA_CMD."v-change-sys-config-value POLICY_SYSTEM_PROTECTED_ADMIN ".escapeshellarg($_POST['v_policy_system_protected_admin']), $output, $return_var);
             check_return_code($return_var,$output);
             unset($output);
-            if (empty($_SESSION['error_msg'])) $v_enforce_subdomain_ownership = $_POST['v_policy_system_protected_admin'];
+            if (empty($_SESSION['error_msg'])) $v_policy_system_protected_admin = $_POST['v_policy_system_protected_admin'];
             $v_security_adv = 'yes';
         }
     }
@@ -745,7 +756,7 @@ if (!empty($_POST['save'])) {
             exec (HESTIA_CMD."v-change-sys-config-value POLICY_USER_CHANGE_THEME ".escapeshellarg($_POST['v_policy_user_change_theme']), $output, $return_var);
             check_return_code($return_var,$output);
             unset($output);
-            if (empty($_SESSION['error_msg'])) $v_enforce_subdomain_ownership = $_POST['v_policy_user_change_theme'];
+            if (empty($_SESSION['error_msg'])) $v_policy_user_change_theme = $_POST['v_policy_user_change_theme'];
             $v_security_adv = 'yes';
         }
     }
@@ -756,7 +767,7 @@ if (!empty($_POST['save'])) {
             exec (HESTIA_CMD."v-change-sys-config-value POLICY_SYSTEM_HIDE_ADMIN ".escapeshellarg($_POST['v_policy_system_hide_admin']), $output, $return_var);
             check_return_code($return_var,$output);
             unset($output);
-            if (empty($_SESSION['error_msg'])) $v_enforce_subdomain_ownership = $_POST['v_policy_system_hide_admin'];
+            if (empty($_SESSION['error_msg'])) $v_policy_system_hide_admin = $_POST['v_policy_system_hide_admin'];
             $v_security_adv = 'yes';
         }
     }

+ 37 - 17
web/templates/admin/edit_server.html

@@ -1037,13 +1037,38 @@
                                                             <br><br>
                                                         </td>
                                                     </tr>
+                                                    <tr>
+                                                        <td class="vst-text input-label">
+                                                            <?php print _('Allow users to reset their passwords');?>
+                                                        </td>
+                                                    </tr>
+                                                    <tr>
+                                                        <td>
+                                                            <select class="vst-list" name="v_policy_system_password_reset">
+                                                                <option value='yes'><?php print _('yes'); ?></option>
+                                                                <option value='no' <?php if($_SESSION['POLICY_SYSTEM_PASSWORD_RESET'] == 'no') echo 'selected' ?> ><?php print _('no'); ?></option>
+                                                            </select>
+                                                            <br><br>
+                                                        </td>
+                                                    </tr>
+                                                    <tr>
+                                                        <td class="vst-text input-label">
+                                                            <?php print _('Inactive session timeout');?> (<?php print _('Minutes');?>)
+                                                        </td>
+                                                    </tr>
+                                                    <tr>
+                                                        <td>
+                                                            <input type="text" size="20" class="vst-input" name="v_inactive_session_timeout" value="<?=trim($_SESSION['INACTIVE_SESSION_TIMEOUT'], "'")?>">
+                                                            <br><br>
+                                                        </td>
+                                                    </tr>
                                                 </table>
                                             </td>
                                         </tr>
                                         <? if (($_SESSION['userContext'] === "admin") && ($_SESSION['user'] === 'admin')) {?>
                                             <tr>
                                                 <td class="section-title" onclick="javascript:elementHideShow('security-sysadminprotect-table');">
-                                                    <?=('System Administrator Protection');?>
+                                                    <?=('System Protection');?>
                                                 </td>
                                                 <td class="section-hide-button">
                                                     <a href="javascript:elementHideShow('security-sysadminprotect-table');"><i class="fas fa-minus-square status-icon dim maroon"></i></a>
@@ -1053,8 +1078,14 @@
                                                 <td>
                                                     <table id="security-sysadminprotect-table" class="step-top" style="display: none;">
                                                         <tr>
-                                                            <td class="vst-text input-label">
-                                                                <?php print _('Restrict access to System Administrator account items');?>
+                                                            <td class="vst-text input-label step-top" style="font-size:0.95rem;">
+                                                                <?=_('System Administrator account');?>
+                                                            </td>
+                                                            
+                                                        </tr>
+                                                        <tr>
+                                                            <td class="vst-text input-label step-top">
+                                                                <?=_('Restrict access to read-only for other administrators');?>
                                                             </td>
                                                         </tr>
                                                         <tr>
@@ -1068,7 +1099,7 @@
                                                         </tr>
                                                         <tr>
                                                             <td class="vst-text input-label">
-                                                                <?php print _('Hide Administrator account from other Administrators');?>
+                                                                <?php print _('Disable access and hide account for other administrators');?>
                                                             </td>
                                                         </tr>
                                                         <tr>
@@ -1097,7 +1128,7 @@
                                                 <table id="security-policies-table" style="display: none;">
                                                 
                                         <tr>
-                                            <td class="vst-text input-label">
+                                            <td class="vst-text input-label step-top">
                                                 <?php print _('Allow users to edit their account details');?>
                                             </td>
                                         </tr>
@@ -1126,7 +1157,7 @@
                                         </tr>
                                         <tr>
                                             <td class="vst-text input-label">
-                                                <?php print _('Allow users to delete action and login history logs');?>
+                                                <?php print _('Allow users to delete log history');?>
                                             </td>
                                         </tr>
                                         <tr>
@@ -1152,17 +1183,6 @@
                                                 <br><br>
                                             </td>
                                         </tr>
-                                        <tr>
-                                            <td class="vst-text input-label">
-                                                <?php print _('Inactive session timeout');?> (<?php print _('Minutes');?>)
-                                            </td>
-                                        </tr>
-                                        <tr>
-                                            <td>
-                                                <input type="text" size="20" class="vst-input" name="v_inactive_session_timeout" value="<?=trim($_SESSION['INACTIVE_SESSION_TIMEOUT'], "'")?>">
-                                                <br><br>
-                                            </td>
-                                        </tr>
                                         <tr>
                                             <td class="vst-text input-label">
                                                 <?php print _('Enforce subdomain ownership');?>

+ 2 - 0
web/templates/login_1.html

@@ -21,11 +21,13 @@
                                         <tr>
                                            <td style="padding: 12px 0 0 2px;">
                                                 <?php print _('Password');?>
+                                                <? if ($_SESSION['POLICY_SYSTEM_PASSWORD_RESET'] !== 'no' ) {?>
                                                 <div style="padding:0 6px 0px 14px; float:right;">
                                                     <a tabindex="5" class="vst-advanced" href="/reset/">
                                                         <?php print _('forgot password');?>
                                                     </a>
                                                 </div>
+                                                <?}?>
                                             </td>
                                         </tr>
                                         <tr>

Некоторые файлы не были показаны из-за большого количества измененных файлов