Kristan Kenney 5 лет назад
Родитель
Сommit
4d7b60b6cd
2 измененных файлов с 21 добавлено и 2 удалено
  1. 19 0
      web/edit/user/index.php
  2. 2 2
      web/templates/pages/edit_user.html

+ 19 - 0
web/edit/user/index.php

@@ -179,6 +179,25 @@ if (!empty($_POST['save'])) {
         unset($output);
     }
 
+    // Update panel login status (admin only)
+    if (empty($_SESSION['error_msg'])) {
+        if ($data[$user]['LOGIN_DISABLED'] != $_POST['v_login_disabled']) {
+            if ($_POST['v_login_disabled'] == 'on') { $_POST['v_login_disabled'] = 'yes'; } else { $_POST['v_login_disabled'] = 'no'; }
+            exec (HESTIA_CMD."v-change-user-config-value ".escapeshellarg($v_username)." LOGIN_DISABLED ".escapeshellarg($_POST['v_login_disabled']), $output, $return_var);
+            check_return_code($return_var,$output);
+            unset($output);
+
+            $v_login_disabled = $_POST['v_login_disabled'];
+        }
+    }
+
+    // Change use IP allow list option (admin only)
+    if (($v_login_use_iplist != $_POST['v_login_use_iplist']) && (empty($_SESSION['error_msg']))) {
+        $v_login_use_iplist = escapeshellarg($_POST['v_login_use_iplist']);
+        exec (HESTIA_CMD."v-change-user-config-value ".escapeshellarg($v_username)." LOGIN_USE_IPLIST ".$v_login_use_iplist, $output, $return_var);
+        check_return_code($return_var,$output);
+        unset($output);
+    }
 
     // Change package (admin only)
     if (($v_package != $_POST['v_package']) && ($_SESSION['userContext'] === 'admin') && (empty($_SESSION['error_msg']))) {

+ 2 - 2
web/templates/pages/edit_user.html

@@ -158,7 +158,7 @@
                             <? if ($_SESSION['userContext'] === 'admin') {?>
                                 <tr>
                                     <td>
-                                        <label><input type="checkbox" size="20" class="vst-checkbox" onclick="javascript:elementHideShow('password-details')" name="v_login_disabled" <?php if ((isset($data[$user]['LOGIN_DISABLED'])) && (!empty($data[$user]['LOGIN_DISABLED'])) && ($data[$user]['LOGIN_DISABLED'] == "yes")) echo "checked=yes" ?>><?php print _('User can not log in to Control Panel');?></label>
+                                        <label><input type="checkbox" size="20" class="vst-checkbox" name="v_login_disabled" <?php if ($data[$user]['LOGIN_DISABLED'] == "yes") echo "checked=yes" ?>><?php print _('User can not log in to Control Panel');?></label>
                                     </td>
                                 </tr>
                             <? } ?>
@@ -172,7 +172,7 @@
                                     <table id="ip-allowlist" style="<? if ($data[$user]['LOGIN_USE_IPLIST'] === 'yes') { echo 'display: table-cell;'; } else { echo 'display: none;'; } ?>">
                                         <tr>
                                             <td>
-                                                <input type="text" size="20" class="vst-input" name="v_login_allowed_ups" value="<?=htmlentities(trim($v_login_allowed_ips, "'"))?>">
+                                                <input type="text" size="20" class="vst-input" name="v_login_allowed_ips" value="<?=htmlentities(trim($v_login_allowed_ips, "'"))?>">
                                                 <input type="hidden" name="v_login_allowed_ips" value="<?=htmlentities(trim($v_login_allowed_ips, "'"))?>">
                                             </td>
                                         </tr>