mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-12-16 05:19:43 +01:00
Fix OWASP toggle: ensure flags reset and prevent loader on page load
1. Move flag reset outside conditional blocks - flags now always reset even if ModSecurity is not installed or AJAX fails 2. Reset flags in error handler (cantLoadInitialDatas) as well 3. Add showLoader parameter to getOWASPAndComodoStatus - loader only shows when explicitly requested, not during initial status check This fixes: - Toggle not responding to clicks (flags were stuck as true) - Spinner showing on initial page load (now only shows during install)
This commit is contained in:
@@ -1278,9 +1278,12 @@ app.controller('modSecRulesPack', function ($scope, $http, $timeout, $window) {
|
|||||||
|
|
||||||
|
|
||||||
getOWASPAndComodoStatus(true);
|
getOWASPAndComodoStatus(true);
|
||||||
function getOWASPAndComodoStatus(updateToggle) {
|
function getOWASPAndComodoStatus(updateToggle, showLoader) {
|
||||||
|
|
||||||
$scope.modsecLoading = false;
|
// Only show loader if explicitly requested (during installations)
|
||||||
|
if (showLoader === true) {
|
||||||
|
$scope.modsecLoading = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
url = "/firewall/getOWASPAndComodoStatus";
|
url = "/firewall/getOWASPAndComodoStatus";
|
||||||
@@ -1324,12 +1327,6 @@ app.controller('modSecRulesPack', function ($scope, $http, $timeout, $window) {
|
|||||||
$scope.comodoDisable = true;
|
$scope.comodoDisable = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reset flags after toggle update
|
|
||||||
$timeout(function() {
|
|
||||||
updatingOWASPStatus = false;
|
|
||||||
updatingComodoStatus = false;
|
|
||||||
}, 100);
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if (response.data.owaspInstalled === 1) {
|
if (response.data.owaspInstalled === 1) {
|
||||||
@@ -1346,10 +1343,19 @@ app.controller('modSecRulesPack', function ($scope, $http, $timeout, $window) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Always reset flags after status check completes
|
||||||
|
$timeout(function() {
|
||||||
|
updatingOWASPStatus = false;
|
||||||
|
updatingComodoStatus = false;
|
||||||
|
}, 100);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function cantLoadInitialDatas(response) {
|
function cantLoadInitialDatas(response) {
|
||||||
$scope.modsecLoading = true;
|
$scope.modsecLoading = true;
|
||||||
|
// Reset flags even on error
|
||||||
|
updatingOWASPStatus = false;
|
||||||
|
updatingComodoStatus = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user