From 337be381a4d9c9eec523858947ffeee9d0585a5a Mon Sep 17 00:00:00 2001 From: usmannasir Date: Sun, 6 Apr 2025 18:37:12 +0500 Subject: [PATCH] move modal inside controller --- .../websiteFunctions/websiteFunctions.js | 26 +++++++++---------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/websiteFunctions/static/websiteFunctions/websiteFunctions.js b/websiteFunctions/static/websiteFunctions/websiteFunctions.js index 3887de381..633964263 100755 --- a/websiteFunctions/static/websiteFunctions/websiteFunctions.js +++ b/websiteFunctions/static/websiteFunctions/websiteFunctions.js @@ -3111,13 +3111,12 @@ app.controller('listWebsites', function ($scope, $http, $window) { } var data = { - wpID: $scope.currentWP.id, - setting: 'PasswordProtection', - PPUsername: $scope.currentWP.PPUsername, - PPPassword: $scope.currentWP.PPPassword + siteId: $scope.currentWP.id, + setting: 'password-protection', + value: 'enable' }; - console.log('Submitting data:', {...data, PPPassword: '[MASKED]'}); + console.log('Submitting data:', data); var config = { headers: { @@ -3141,7 +3140,7 @@ app.controller('listWebsites', function ($scope, $http, $window) { console.log('Password protection updated successfully'); new PNotify({ title: 'Success!', - text: 'Password protection updated successfully!', + text: 'Password protection enabled successfully!', type: 'success' }); location.reload(); @@ -3149,7 +3148,7 @@ app.controller('listWebsites', function ($scope, $http, $window) { console.log('Failed to update password protection:', response.data.error_message); new PNotify({ title: 'Error!', - text: response.data.error_message || 'Failed to update password protection', + text: response.data.error_message || 'Failed to enable password protection', type: 'error' }); // Revert the checkbox state @@ -6514,13 +6513,12 @@ $scope.submitPasswordProtection = function() { } var data = { - wpID: $scope.currentWP.id, - setting: 'PasswordProtection', - PPUsername: $scope.currentWP.PPUsername, - PPPassword: $scope.currentWP.PPPassword + siteId: $scope.currentWP.id, + setting: 'password-protection', + value: 'enable' }; - console.log('Submitting data:', {...data, PPPassword: '[MASKED]'}); + console.log('Submitting data:', data); var config = { headers: { @@ -6544,7 +6542,7 @@ $scope.submitPasswordProtection = function() { console.log('Password protection updated successfully'); new PNotify({ title: 'Success!', - text: 'Password protection updated successfully!', + text: 'Password protection enabled successfully!', type: 'success' }); location.reload(); @@ -6552,7 +6550,7 @@ $scope.submitPasswordProtection = function() { console.log('Failed to update password protection:', response.data.error_message); new PNotify({ title: 'Error!', - text: response.data.error_message || 'Failed to update password protection', + text: response.data.error_message || 'Failed to enable password protection', type: 'error' }); // Revert the checkbox state