From 2fa3a8357e6c95d9441f191a95368d42bbe68680 Mon Sep 17 00:00:00 2001 From: usmannasir Date: Wed, 25 Oct 2023 12:24:54 +0500 Subject: [PATCH 1/6] bug fix in urls --- baseTemplate/urls.py | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/baseTemplate/urls.py b/baseTemplate/urls.py index b4574ce36..509fbe6c5 100755 --- a/baseTemplate/urls.py +++ b/baseTemplate/urls.py @@ -2,17 +2,22 @@ from . import views urlpatterns = [ - path('', views.renderBase, name='index'), - path('getSystemStatus', views.getSystemStatus, name='getSystemInformation'), - path('getAdminStatus', views.getAdminStatus, name='getSystemInformation'), - path('getLoadAverage', views.getLoadAverage, name='getLoadAverage'), - path('versionManagment', views.versionManagement, name='versionManagement'), - path('design', views.design, name='design'), - path('getthemedata', views.getthemedata, name='getthemedata'), + url(r'^$', views.renderBase, name='index'), + url(r'^getSystemStatus$',views.getSystemStatus, name='getSystemInformation'), + url(r'^getAdminStatus',views.getAdminStatus, name='getSystemInformation'), + url(r'^getLoadAverage',views.getLoadAverage, name='getLoadAverage'), + url(r'^versionManagment',views.versionManagement, name='versionManagment'), + url(r'^design', views.design, name='design'), + url(r'^getthemedata', views.getthemedata, name='getthemedata'), + + #url(r'^upgrade',views.upgrade, name='upgrade'), + + url(r'^UpgradeStatus',views.upgradeStatus, name='UpgradeStatus'), + url(r'^upgradeVersion',views.upgradeVersion, name='upgradeVersion'), # Add this URL pattern for 'upgrade_cyberpanel' - path('upgrade_cyberpanel', views.upgrade_cyberpanel, name='upgrade_cyberpanel'), + url(r'upgrade_cyberpanel', views.upgrade_cyberpanel, name='upgrade_cyberpanel'), + url(r'UpgradeStatus', views.upgradeStatus, name='UpgradeStatus'), + url(r'upgradeVersion', views.upgradeVersion, name='upgradeVersion'), - path('UpgradeStatus', views.upgradeStatus, name='UpgradeStatus'), - path('upgradeVersion', views.upgradeVersion, name='upgradeVersion'), -] +] \ No newline at end of file From b98f9793994f1521f155309097c45aa1d4fc7cf2 Mon Sep 17 00:00:00 2001 From: usmannasir Date: Wed, 25 Oct 2023 12:32:02 +0500 Subject: [PATCH 2/6] bug fix in upgrade function --- baseTemplate/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/baseTemplate/views.py b/baseTemplate/views.py index 1f8cd674d..45fc3aa49 100755 --- a/baseTemplate/views.py +++ b/baseTemplate/views.py @@ -150,7 +150,7 @@ def upgrade(request): res = subprocess.call(cmd) vers = version.objects.get(pk=1) - from upgrade import Upgrade + from plogical.upgrade import Upgrade Upgrade.initiateUpgrade(vers.currentVersion, vers.build) adminData = {"upgrade": 1} json_data = json.dumps(adminData) From 041a27bafd41ebf4f53bd7e9408b22c8435eaf6a Mon Sep 17 00:00:00 2001 From: xmok <30526133+xmok@users.noreply.github.com> Date: Wed, 25 Oct 2023 19:38:08 +0500 Subject: [PATCH 3/6] make sure TTL is 0-86400 inclusive when add or update --- dns/dnsManager.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/dns/dnsManager.py b/dns/dnsManager.py index 7142455b6..8746c212f 100755 --- a/dns/dnsManager.py +++ b/dns/dnsManager.py @@ -257,6 +257,10 @@ def addDNSRecord(self, userID = None, data = None): recordType = data['recordType'] recordName = data['recordName'] ttl = int(data['ttl']) + if ttl < 0: + raise ValueError("TTL: The item must be greater than 0") + elif ttl > 86400: + raise ValueError("TTL: The item must be lesser than 86401") admin = Administrator.objects.get(pk=userID) if ACLManager.checkOwnershipZone(zoneDomain, admin, currentACL) == 1: @@ -444,6 +448,10 @@ def updateRecord(self, userID = None, data = None): if data['ttlNow'] != None: record.ttl = int(data['ttlNow']) + if record.ttl < 0: + raise ValueError("TTL: The item must be greater than 0") + elif record.ttl > 86400: + raise ValueError("TTL: The item must be lesser than 86401") if data['priorityNow'] != None: record.prio = int(data['priorityNow']) @@ -826,6 +834,10 @@ def addDNSRecordCloudFlare(self, userID = None, data = None): recordType = data['recordType'] recordName = data['recordName'] ttl = int(data['ttl']) + if ttl < 0: + raise ValueError("TTL: The item must be greater than 0") + elif ttl > 86400: + raise ValueError("TTL: The item must be lesser than 86401") admin = Administrator.objects.get(pk=userID) self.admin = admin From 41392b6bdab5239bd557ff3334ae37a70fb26d4b Mon Sep 17 00:00:00 2001 From: xmok <30526133+xmok@users.noreply.github.com> Date: Wed, 25 Oct 2023 19:53:13 +0500 Subject: [PATCH 4/6] add min,max to TTL input field in addDeleteDNSRecords --- dns/templates/dns/addDeleteDNSRecords.html | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/dns/templates/dns/addDeleteDNSRecords.html b/dns/templates/dns/addDeleteDNSRecords.html index ddf235262..6fde8f740 100755 --- a/dns/templates/dns/addDeleteDNSRecords.html +++ b/dns/templates/dns/addDeleteDNSRecords.html @@ -88,7 +88,7 @@

{% trans "PowerDNS is disabled." %}
-
@@ -114,7 +114,7 @@

{% trans "PowerDNS is disabled." %}
-
@@ -141,7 +141,7 @@

{% trans "PowerDNS is disabled." %}
-
@@ -167,7 +167,7 @@

{% trans "PowerDNS is disabled." %}
-
@@ -199,7 +199,7 @@

{% trans "PowerDNS is disabled." %}
-
@@ -226,7 +226,7 @@

{% trans "PowerDNS is disabled." %}
-
@@ -253,7 +253,7 @@

{% trans "PowerDNS is disabled." %}
-
@@ -280,7 +280,7 @@

{% trans "PowerDNS is disabled." %}
-
@@ -307,7 +307,7 @@

{% trans "PowerDNS is disabled." %}
-
@@ -337,7 +337,7 @@

{% trans "PowerDNS is disabled." %} ng-model="recordName">
-
From 8aca0ba9141d569f377a162b346cb055121c4ce5 Mon Sep 17 00:00:00 2001 From: Mark Honeychurch Date: Mon, 30 Oct 2023 20:14:49 +1300 Subject: [PATCH 5/6] Update cliParser.py Fix typo where "First name" had been replicated --- cli/cliParser.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli/cliParser.py b/cli/cliParser.py index bd7ef4231..7427e7f1f 100755 --- a/cli/cliParser.py +++ b/cli/cliParser.py @@ -58,7 +58,7 @@ def prepareArguments(self): ### Additional Arguments for user manager parser.add_argument('--firstName', help='First name while creating user.') - parser.add_argument('--lastName', help='First name while creating user.') + parser.add_argument('--lastName', help='Last name while creating user.') parser.add_argument('--websitesLimit', help='Website limit while creating user.') parser.add_argument('--selectedACL', help='Select ACL while creating user.') parser.add_argument('--securityLevel', help='Set security level while creating user.') From 4bc1f4c70ac0b447c85624a830531d4d811a7a3c Mon Sep 17 00:00:00 2001 From: Mark Honeychurch Date: Mon, 30 Oct 2023 20:30:56 +1300 Subject: [PATCH 6/6] Update views.py Fix several typos --- userManagment/views.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/userManagment/views.py b/userManagment/views.py index 47dbba044..5e5c20e43 100755 --- a/userManagment/views.py +++ b/userManagment/views.py @@ -135,12 +135,12 @@ def submitUserCreation(request): selectedACL = data['selectedACL'] if ACLManager.CheckRegEx("^[\w'\-,.][^0-9_!¡?÷?¿/\\+=@#$%ˆ&*(){}|~<>;:[\]]{2,}$", firstName) == 0: - data_ret = {'status': 0, 'createStatus': 0, 'error_message': 'First Name can only contain Alphabets and should be more then 2 characters..'} + data_ret = {'status': 0, 'createStatus': 0, 'error_message': 'First Name can only contain alphabetic characters, and should be more than 2 characters long...'} json_data = json.dumps(data_ret) return HttpResponse(json_data) if ACLManager.CheckRegEx("^[\w'\-,.][^0-9_!¡?÷?¿/\\+=@#$%ˆ&*(){}|~<>;:[\]]{2,}$", lastName) == 0: - data_ret = {'status': 0, 'createStatus': 0, 'error_message': 'First Name can only contain Alphabets and should be more then 2 characters..'} + data_ret = {'status': 0, 'createStatus': 0, 'error_message': 'Last Name can only contain alphabetic characters, and should be more than 2 characters long...'} json_data = json.dumps(data_ret) return HttpResponse(json_data)