diff --git a/backup/static/backup/backup.js b/backup/static/backup/backup.js index 83ac2daec..10bd2cc14 100755 --- a/backup/static/backup/backup.js +++ b/backup/static/backup/backup.js @@ -2049,54 +2049,133 @@ app.controller('backupPlanNowOneClick', function ($scope, $http, $window) { $scope.cyberpanelLoading = true; $scope.sftpHide = true; $scope.localHide = true; + $scope.showVerification = false; $scope.verificationCodeSent = false; $scope.emailVerified = false; + $scope.showEmailVerification = function() { + $scope.showVerification = true; + }; + + $scope.cancelVerification = function() { + $scope.showVerification = false; + $scope.verificationCodeSent = false; + $scope.verificationEmail = ''; + $scope.verificationCode = ''; + }; + $scope.sendVerificationCode = function() { - $scope.cyberpanelLoading = true; + $scope.cyberpanelLoading = false; + + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; $http.post('https://platform.cyberpersons.com/Billing/SendBackupVerificationCode', { email: $scope.verificationEmail - }).then(function(response) { + }, config).then(function(response) { + $scope.cyberpanelLoading = true; if (response.data.status == 1) { $scope.verificationCodeSent = true; + new PNotify({ + title: 'Success', + text: 'Verification code sent to your email.', + type: 'success' + }); } else { - alert(response.data.error_message); + new PNotify({ + title: 'Error', + text: response.data.error_message, + type: 'error' + }); } - $scope.cyberpanelLoading = false; + }, function(error) { + $scope.cyberpanelLoading = true; + new PNotify({ + title: 'Error', + text: 'Could not send verification code. Please try again.', + type: 'error' + }); }); }; $scope.verifyCode = function() { - $scope.cyberpanelLoading = true; + $scope.cyberpanelLoading = false; + + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; $http.post('https://platform.cyberpersons.com/Billing/VerifyBackupCode', { email: $scope.verificationEmail, code: $scope.verificationCode - }).then(function(response) { + }, config).then(function(response) { + $scope.cyberpanelLoading = true; if (response.data.status == 1) { $scope.emailVerified = true; + $scope.showVerification = false; // Fetch backup plans after successful verification $scope.fetchBackupPlans(); + new PNotify({ + title: 'Success', + text: 'Email verified successfully.', + type: 'success' + }); } else { - alert(response.data.error_message); + new PNotify({ + title: 'Error', + text: response.data.error_message, + type: 'error' + }); } - $scope.cyberpanelLoading = false; + }, function(error) { + $scope.cyberpanelLoading = true; + new PNotify({ + title: 'Error', + text: 'Could not verify code. Please try again.', + type: 'error' + }); }); }; $scope.fetchBackupPlans = function() { - $scope.cyberpanelLoading = true; + $scope.cyberpanelLoading = false; + + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; $http.post('https://platform.cyberpersons.com/Billing/FetchBackupPlans', { email: $scope.verificationEmail - }).then(function(response) { + }, config).then(function(response) { + $scope.cyberpanelLoading = true; if (response.data.status == 1) { $scope.plans = response.data.plans; + new PNotify({ + title: 'Success', + text: 'Backup plans fetched successfully.', + type: 'success' + }); } else { - alert(response.data.error_message); + new PNotify({ + title: 'Error', + text: response.data.error_message, + type: 'error' + }); } - $scope.cyberpanelLoading = false; + }, function(error) { + $scope.cyberpanelLoading = true; + new PNotify({ + title: 'Error', + text: 'Could not fetch backup plans. Please try again.', + type: 'error' + }); }); }; diff --git a/backup/templates/backup/oneClickBackups.html b/backup/templates/backup/oneClickBackups.html index 0828ebb27..7799d15ff 100755 --- a/backup/templates/backup/oneClickBackups.html +++ b/backup/templates/backup/oneClickBackups.html @@ -21,8 +21,23 @@
+
-
+ You have successfully purchased a backup plan.
-Your purchase was not successful.
{{ message }} -You have successfully purchased a backup plan.
+Your purchase was not successful.
{{ message }} +
-
+ | {% trans "Plan Name" %} | -{% trans "Monthly Price" %} | -{% trans "Yearly Price" %} | -{% trans "Actions" %} | -
|---|
| {{ plan.name }} | -${{ plan.monthlyPrice }} | -${{ plan.yearlyPrice }} | -- {% if plan.name != '100GB' %} - - {% endif %} - - {% if plan.name != '100GB' %} - - {% endif %} - - | +{% trans "Plan Name" %} | +{% trans "Monthly Price" %} | +{% trans "Yearly Price" %} | +{% trans "Actions" %} |
|---|