From 38f1b301ada6590f65ae483b35fae8a3f9a9036c Mon Sep 17 00:00:00 2001 From: usmannasir Date: Sun, 13 Apr 2025 12:49:45 +0500 Subject: [PATCH] add code to fetch existing backups --- backup/static/backup/backup.js | 50 ++++ backup/templates/backup/oneClickBackups.html | 276 ++++++++++--------- 2 files changed, 199 insertions(+), 127 deletions(-) diff --git a/backup/static/backup/backup.js b/backup/static/backup/backup.js index 1500147a8..83ac2daec 100755 --- a/backup/static/backup/backup.js +++ b/backup/static/backup/backup.js @@ -2049,6 +2049,56 @@ app.controller('backupPlanNowOneClick', function ($scope, $http, $window) { $scope.cyberpanelLoading = true; $scope.sftpHide = true; $scope.localHide = true; + $scope.verificationCodeSent = false; + $scope.emailVerified = false; + + $scope.sendVerificationCode = function() { + $scope.cyberpanelLoading = true; + + $http.post('https://platform.cyberpersons.com/Billing/SendBackupVerificationCode', { + email: $scope.verificationEmail + }).then(function(response) { + if (response.data.status == 1) { + $scope.verificationCodeSent = true; + } else { + alert(response.data.error_message); + } + $scope.cyberpanelLoading = false; + }); + }; + + $scope.verifyCode = function() { + $scope.cyberpanelLoading = true; + + $http.post('https://platform.cyberpersons.com/Billing/VerifyBackupCode', { + email: $scope.verificationEmail, + code: $scope.verificationCode + }).then(function(response) { + if (response.data.status == 1) { + $scope.emailVerified = true; + // Fetch backup plans after successful verification + $scope.fetchBackupPlans(); + } else { + alert(response.data.error_message); + } + $scope.cyberpanelLoading = false; + }); + }; + + $scope.fetchBackupPlans = function() { + $scope.cyberpanelLoading = true; + + $http.post('https://platform.cyberpersons.com/Billing/FetchBackupPlans', { + email: $scope.verificationEmail + }).then(function(response) { + if (response.data.status == 1) { + $scope.plans = response.data.plans; + } else { + alert(response.data.error_message); + } + $scope.cyberpanelLoading = false; + }); + }; $scope.BuyNowBackupP = function (planName, monthlyPrice, yearlyPrice, months) { diff --git a/backup/templates/backup/oneClickBackups.html b/backup/templates/backup/oneClickBackups.html index 902572294..0828ebb27 100755 --- a/backup/templates/backup/oneClickBackups.html +++ b/backup/templates/backup/oneClickBackups.html @@ -5,7 +5,6 @@ {% load static %} - {% get_current_language as LANGUAGE_CODE %} @@ -22,160 +21,183 @@
-

- {% trans "Set up Backup Destinations." %} -

-
- - {% if status == 1 %} + +
+
-

You have successfully purchased a backup plan.

+

{% trans "Verify Your Email" %}

+

{% trans "Please enter the email address used for your backup subscription to access your backup plans." %}

- {% elif status == 0 %} - -
-

Your purchase was not successful.

{{ message }} + +
+ +
+ +
- {% elif status == 4 %} -
- {{ message }} +
+ +
+ +
- {% endif %} - -
- -

With CyberPanel's one-click backups, you can easily back - up your website to our secure - servers in just 60 seconds. It's simple, fast, and reliable.

- - -
-
+ + +
+
+
+
- - - - - - - - - - - - - {% for plan in bPlans %} + +
+

+ {% trans "Set up Backup Destinations." %} +

+
+ + {% if status == 1 %} +
+

You have successfully purchased a backup plan.

+
+ {% elif status == 0 %} +
+

Your purchase was not successful.

{{ message }} +
+ {% elif status == 4 %} +
+ {{ message }} +
+ {% endif %} + + +

With CyberPanel's one-click backups, you can easily back + up your website to our secure + servers in just 60 seconds. It's simple, fast, and reliable.

+ + + +
+
+
{% trans "Account" %}{% trans "Plan Name" %}{% trans "Subscription" %}{% trans "Billing Cycle" %}{% trans "Purchase Date" %}{% trans "Actions" %}
+ - - - - {% if plan.months == '1' %} - - {% else %} - - {% endif %} - - + + + + + + + + + {% for plan in bPlans %} + + + + + {% if plan.months == '1' %} + {% else %} - + {% endif %} - - - - - {% endfor %} - -
{{ plan.sftpUser }}{{ plan.planName }}{{ plan.subscription }}${{ plan.price }}/month${{ plan.price }}/year{{ plan.date }} - {% if plan.state == 1 %} - - - - - - + {% trans "Account" %}{% trans "Plan Name" %}{% trans "Subscription" %}{% trans "Billing Cycle" %}{% trans "Purchase Date" %}{% trans "Actions" %}
{{ plan.sftpUser }}{{ plan.planName }}{{ plan.subscription }}${{ plan.price }}/month${{ plan.price }}/year
+ {{ plan.date }} + + {% if plan.state == 1 %} + + + + + + + {% else %} + + {% endif %} + + + {% endfor %} + + +
-
- - + - + -

- {% trans "Subscribe to one-click backup plans." %} -

+

+ {% trans "Subscribe to one-click backup plans." %} +

-
-
- - - - - - - - - - - {% for plan in plans %} +
+
+
{% trans "Plan Name" %}{% trans "Monthly Price" %}{% trans "Yearly Price" %}{% trans "Actions" %}
+ - - - - - + + + + - {% endfor %} - -
{{ 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" %}
+ + + {% for plan in plans %} + + {{ plan.name }} + ${{ plan.monthlyPrice }} + ${{ plan.yearlyPrice }} + + {% if plan.name != '100GB' %} + + {% endif %} + + {% if plan.name != '100GB' %} + + {% endif %} + + + + {% endfor %} + + +
-
- - + - - - - - + + +
- - - {% endblock %} \ No newline at end of file