Skip to content

Commit 713e62b

Browse files
authored
Merge pull request hestiacp#2004 from jaapmarcus/fix-add-min-check
Prevent 0 valid value for INACTIVE_SESSION_TIMEOUT
2 parents 955f0fd + 53935bd commit 713e62b

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

web/edit/server/index.php

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -697,10 +697,14 @@
697697
// Change INACTIVE_SESSION_TIMEOUT
698698
if (empty($_SESSION['error_msg'])) {
699699
if ($_POST['v_inactive_session_timeout'] != $_SESSION['INACTIVE_SESSION_TIMEOUT']) {
700-
exec (HESTIA_CMD."v-change-sys-config-value INACTIVE_SESSION_TIMEOUT ".escapeshellarg($_POST['v_inactive_session_timeout']), $output, $return_var);
701-
check_return_code($return_var,$output);
702-
unset($output);
703-
if (empty($_SESSION['error_msg'])) $v_login_style = $_POST['v_inactive_session_timeout'];
700+
if($_POST['v_inactive_session_timeout'] < 1){
701+
$_SESSION['error_msg'] = _('Inactive session timeout can not lower then 1 minute');
702+
}else{
703+
exec (HESTIA_CMD."v-change-sys-config-value INACTIVE_SESSION_TIMEOUT ".escapeshellarg($_POST['v_inactive_session_timeout']), $output, $return_var);
704+
check_return_code($return_var,$output);
705+
unset($output);
706+
if (empty($_SESSION['error_msg'])) $v_login_style = $_POST['v_inactive_session_timeout'];
707+
}
704708
$v_security_adv = 'yes';
705709
}
706710
}
@@ -795,7 +799,7 @@
795799

796800
// Change POLICY_USER_VIEW_SUSPENDED
797801
if (empty($_SESSION['error_msg'])) {
798-
if ($_POST['v_policy_user_view_suspended'] != $_SESSION['POLICY_USER_VIEW_SUSPENDED']) {
802+
if ($_POST['v_policy_user_view_suspended'] != $_SESSION['POLICY_USER_VIEW_SUSPENDED'] && !empty($_SESSION['POLICY_USER_VIEW_SUSPENDED'])) {
799803
exec (HESTIA_CMD."v-change-sys-config-value POLICY_USER_VIEW_SUSPENDED ".escapeshellarg($_POST['v_policy_user_view_suspended']), $output, $return_var);
800804
check_return_code($return_var,$output);
801805
unset($output);

0 commit comments

Comments
 (0)