Skip to content

Commit 4d7b60b

Browse files
author
Kristan Kenney
committed
Switch options on/off
1 parent a302fbc commit 4d7b60b

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

web/edit/user/index.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,25 @@
179179
unset($output);
180180
}
181181

182+
// Update panel login status (admin only)
183+
if (empty($_SESSION['error_msg'])) {
184+
if ($data[$user]['LOGIN_DISABLED'] != $_POST['v_login_disabled']) {
185+
if ($_POST['v_login_disabled'] == 'on') { $_POST['v_login_disabled'] = 'yes'; } else { $_POST['v_login_disabled'] = 'no'; }
186+
exec (HESTIA_CMD."v-change-user-config-value ".escapeshellarg($v_username)." LOGIN_DISABLED ".escapeshellarg($_POST['v_login_disabled']), $output, $return_var);
187+
check_return_code($return_var,$output);
188+
unset($output);
189+
190+
$v_login_disabled = $_POST['v_login_disabled'];
191+
}
192+
}
193+
194+
// Change use IP allow list option (admin only)
195+
if (($v_login_use_iplist != $_POST['v_login_use_iplist']) && (empty($_SESSION['error_msg']))) {
196+
$v_login_use_iplist = escapeshellarg($_POST['v_login_use_iplist']);
197+
exec (HESTIA_CMD."v-change-user-config-value ".escapeshellarg($v_username)." LOGIN_USE_IPLIST ".$v_login_use_iplist, $output, $return_var);
198+
check_return_code($return_var,$output);
199+
unset($output);
200+
}
182201

183202
// Change package (admin only)
184203
if (($v_package != $_POST['v_package']) && ($_SESSION['userContext'] === 'admin') && (empty($_SESSION['error_msg']))) {

web/templates/pages/edit_user.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@
158158
<? if ($_SESSION['userContext'] === 'admin') {?>
159159
<tr>
160160
<td>
161-
<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>
161+
<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>
162162
</td>
163163
</tr>
164164
<? } ?>
@@ -172,7 +172,7 @@
172172
<table id="ip-allowlist" style="<? if ($data[$user]['LOGIN_USE_IPLIST'] === 'yes') { echo 'display: table-cell;'; } else { echo 'display: none;'; } ?>">
173173
<tr>
174174
<td>
175-
<input type="text" size="20" class="vst-input" name="v_login_allowed_ups" value="<?=htmlentities(trim($v_login_allowed_ips, "'"))?>">
175+
<input type="text" size="20" class="vst-input" name="v_login_allowed_ips" value="<?=htmlentities(trim($v_login_allowed_ips, "'"))?>">
176176
<input type="hidden" name="v_login_allowed_ips" value="<?=htmlentities(trim($v_login_allowed_ips, "'"))?>">
177177
</td>
178178
</tr>

0 commit comments

Comments
 (0)