From 63877fba662d38bf67012001aeb179f8d31dd7ff Mon Sep 17 00:00:00 2001 From: master3395 Date: Fri, 30 Jan 2026 20:34:29 +0100 Subject: [PATCH] Dashboard, user management, and FTP quota fixes for v2.5.5-dev - base: Clickable insight cards (Users, Websites, WordPress, DBs, Emails, FTP) - base: data-cfasync=false on scripts for Cloudflare Rocket Loader compatibility - userManagment: createUser/modifyUser/createACL/apiAccess fixes, alert logic - websiteFunctions: FTP quota management, createWebsite, ACLManager fix --- .../templates/baseTemplate/homePage.html | 34 +++-- .../templates/baseTemplate/index.html | 34 ++--- .../static/userManagment/userManagment.js | 143 +++++++++--------- .../templates/userManagment/apiAccess.html | 42 +++-- .../templates/userManagment/createACL.html | 11 +- .../templates/userManagment/createUser.html | 24 +-- .../templates/userManagment/modifyUser.html | 17 ++- userManagment/views.py | 4 +- .../websiteFunctions/createWebsite.html | 4 +- .../websiteFunctions/ftpQuotaManagement.html | 20 ++- websiteFunctions/website.py | 20 +-- 11 files changed, 201 insertions(+), 152 deletions(-) diff --git a/baseTemplate/templates/baseTemplate/homePage.html b/baseTemplate/templates/baseTemplate/homePage.html index 6f4f8545a..2a1aef84f 100644 --- a/baseTemplate/templates/baseTemplate/homePage.html +++ b/baseTemplate/templates/baseTemplate/homePage.html @@ -132,6 +132,16 @@ cursor: pointer; } + a.insight-link { + text-decoration: none; + color: inherit; + display: block; + } + + a.insight-link:hover { + color: inherit; + } + .insight-card:hover { transform: translateY(-5px); box-shadow: 0 5px 20px rgba(91,95,207,0.1); @@ -730,53 +740,53 @@

INSIGHTS

diff --git a/baseTemplate/templates/baseTemplate/index.html b/baseTemplate/templates/baseTemplate/index.html index e7276f0fd..f00f3828f 100644 --- a/baseTemplate/templates/baseTemplate/index.html +++ b/baseTemplate/templates/baseTemplate/index.html @@ -42,9 +42,9 @@ - + - + @@ -2178,22 +2178,22 @@ {% block content %}{% endblock %} - - - - - - - + + + + + + + - - - - - - - - + + + + + + + + {% get_current_language as LANGUAGE_CODE %} @@ -576,24 +578,36 @@ {% get_current_language as LANGUAGE_CODE %} @@ -216,13 +217,13 @@ {% trans "Create ACL" %} -
- {% trans "ACL with name:" %} {$ aclName $} {% trans "is successfully created." %} +
+ {% trans "ACL with name:" %} {% trans "is successfully created." %}
-
- {% trans "Cannot create ACL. Error message:" %} {$ errorMessage $} +
+ {% trans "Cannot create ACL. Error message:" %}
-
+
{% trans "Could not connect to server. Please refresh this page." %}
diff --git a/userManagment/templates/userManagment/createUser.html b/userManagment/templates/userManagment/createUser.html index 9de5aeea8..d88a7c61b 100644 --- a/userManagment/templates/userManagment/createUser.html +++ b/userManagment/templates/userManagment/createUser.html @@ -4,6 +4,8 @@ {% block content %} {% load static %} + {# Ensure createUserCtr is registered before Angular compiles #} + {% get_current_language as LANGUAGE_CODE %} @@ -250,9 +252,9 @@
- -
+
{% trans "First Name should contain only alphabetic characters." %}
@@ -260,9 +262,9 @@
- -
+
{% trans "Last Name should contain only alphabetic characters." %}
@@ -272,7 +274,7 @@
-
+
{% trans "Please enter a valid email address" %}
@@ -348,19 +350,19 @@
-
- {% trans "Account with username:" %} {$ userName $} {% trans "is successfully created." %} +
+ {% trans "Account with username:" %} {% trans "is successfully created." %}
-
- {% trans "Cannot create user. Error message:" %} {$ errorMessage $} +
+ {% trans "Cannot create user. Error message:" %}
-
+
{% trans "Could not connect to server. Please refresh this page." %}
-
+
{% trans "Length of first and last name combined should be less than or equal to 20 characters" %}
diff --git a/userManagment/templates/userManagment/modifyUser.html b/userManagment/templates/userManagment/modifyUser.html index d3b4a7427..facd00369 100644 --- a/userManagment/templates/userManagment/modifyUser.html +++ b/userManagment/templates/userManagment/modifyUser.html @@ -5,6 +5,7 @@ {% block content %} {% load static %} + {% get_current_language as LANGUAGE_CODE %} @@ -427,19 +428,19 @@
-
- {% trans "Account with username:" %} {$ userName $} {% trans "is successfully modified." %} +
+ {% trans "Account with username:" %} {% trans "is successfully modified." %}
-
- {% trans "Cannot modify user. Error message:" %} {$ errorMessage $} +
+ {% trans "Cannot modify user. Error message:" %}
-
+
{% trans "Could not connect to server. Please refresh this page." %}
-
- {% trans "Cannot fetch details. Error message:" %} {$ errorMessage $} +
+ {% trans "Cannot fetch details. Error message:" %}
-
+
{% trans "User details loaded successfully." %}
diff --git a/userManagment/views.py b/userManagment/views.py index a43cf5632..fab69cfc2 100644 --- a/userManagment/views.py +++ b/userManagment/views.py @@ -220,7 +220,7 @@ def submitUserCreation(request): if ACLManager.CheckRegEx("^[\w'\-,.][^0-9_!¡?÷?¿/\\+=@#$%ˆ&*(){}|~<>;:[\]]{2,}$", firstName) == 0: 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) + return HttpResponse(json_data, content_type='application/json') if ACLManager.CheckRegEx("^[\w'\-,.][^0-9_!¡?÷?¿/\\+=@#$%ˆ&*(){}|~<>;:[\]]{2,}$", lastName) == 0: data_ret = {'status': 0, 'createStatus': 0, 'error_message': 'Last Name can only contain alphabetic characters, and should be more than 2 characters long...'} @@ -362,7 +362,7 @@ def submitUserCreation(request): data_ret = {'status': 1, 'createStatus': 1, 'error_message': "None"} final_json = json.dumps(data_ret) - return HttpResponse(final_json) + return HttpResponse(final_json, content_type='application/json') except Exception as e: secure_log_error(e, 'submitUserCreation', request.session.get('userID', 'Unknown')) diff --git a/websiteFunctions/templates/websiteFunctions/createWebsite.html b/websiteFunctions/templates/websiteFunctions/createWebsite.html index fe41959af..fe96a498c 100644 --- a/websiteFunctions/templates/websiteFunctions/createWebsite.html +++ b/websiteFunctions/templates/websiteFunctions/createWebsite.html @@ -391,7 +391,7 @@ -
+
{% trans "Invalid Domain (Note: You don't need to add 'http' or 'https')" %}
@@ -401,7 +401,7 @@ -
+
{% trans "Invalid Email" %}
diff --git a/websiteFunctions/templates/websiteFunctions/ftpQuotaManagement.html b/websiteFunctions/templates/websiteFunctions/ftpQuotaManagement.html index e538f4289..8f2545a5c 100644 --- a/websiteFunctions/templates/websiteFunctions/ftpQuotaManagement.html +++ b/websiteFunctions/templates/websiteFunctions/ftpQuotaManagement.html @@ -6,6 +6,24 @@ FTP Quota Management - CyberPanel {% endblock %} {% block content %} +
@@ -18,7 +36,7 @@ FTP Quota Management - CyberPanel
-
+
FTP Quota System
diff --git a/websiteFunctions/website.py b/websiteFunctions/website.py index 576c272c6..d2bcfee56 100644 --- a/websiteFunctions/website.py +++ b/websiteFunctions/website.py @@ -8744,7 +8744,7 @@ StrictHostKeyChecking no admin = Administrator.objects.get(pk=userID) # Check if user has permission - if not ACLManager.checkIfUserIsAdmin(currentACL): + if not (currentACL.get('admin', 0) == 1): return ACLManager.loadErrorJson('status', 0) # Backup existing configurations @@ -8811,7 +8811,7 @@ StrictHostKeyChecking no admin = Administrator.objects.get(pk=userID) # Check if user has permission - if not ACLManager.checkIfUserIsAdmin(currentACL): + if not (currentACL.get('admin', 0) == 1): return ACLManager.loadErrorJson('status', 0) quotas = FTPQuota.objects.all().order_by('-created_at') @@ -8856,7 +8856,7 @@ StrictHostKeyChecking no admin = Administrator.objects.get(pk=userID) # Check if user has permission - if not ACLManager.checkIfUserIsAdmin(currentACL): + if not (currentACL.get('admin', 0) == 1): return ACLManager.loadErrorJson('status', 0) quota_id = data.get('quota_id') @@ -8899,7 +8899,7 @@ StrictHostKeyChecking no admin = Administrator.objects.get(pk=userID) # Check if user has permission - if not ACLManager.checkIfUserIsAdmin(currentACL): + if not (currentACL.get('admin', 0) == 1): return ACLManager.loadErrorJson('status', 0) reset_type = data.get('reset_type', 'manual') @@ -8970,7 +8970,7 @@ StrictHostKeyChecking no admin = Administrator.objects.get(pk=userID) # Check if user has permission - if not ACLManager.checkIfUserIsAdmin(currentACL): + if not (currentACL.get('admin', 0) == 1): return ACLManager.loadErrorJson('status', 0) logs = BandwidthResetLog.objects.all().order_by('-reset_at')[:50] # Last 50 entries @@ -9013,7 +9013,7 @@ StrictHostKeyChecking no admin = Administrator.objects.get(pk=userID) # Check if user has permission - if not ACLManager.checkIfUserIsAdmin(currentACL): + if not (currentACL.get('admin', 0) == 1): return ACLManager.loadErrorJson('status', 0) schedule_type = data.get('schedule_type', 'monthly') # monthly, weekly, daily @@ -9068,7 +9068,7 @@ StrictHostKeyChecking no admin = Administrator.objects.get(pk=userID) # Check if user has permission - if not ACLManager.checkIfUserIsAdmin(currentACL): + if not (currentACL.get('admin', 0) == 1): return ACLManager.loadErrorJson('status', 0) ip_address = data.get('ip_address') @@ -9119,7 +9119,7 @@ StrictHostKeyChecking no admin = Administrator.objects.get(pk=userID) # Check if user has permission - if not ACLManager.checkIfUserIsAdmin(currentACL): + if not (currentACL.get('admin', 0) == 1): return ACLManager.loadErrorJson('status', 0) ip_address = data.get('ip_address') @@ -9169,7 +9169,7 @@ StrictHostKeyChecking no admin = Administrator.objects.get(pk=userID) # Check if user has permission - if not ACLManager.checkIfUserIsAdmin(currentACL): + if not (currentACL.get('admin', 0) == 1): return ACLManager.loadErrorJson('status', 0) # Import firewall utilities @@ -9203,7 +9203,7 @@ StrictHostKeyChecking no admin = Administrator.objects.get(pk=userID) # Check if user has permission - if not ACLManager.checkIfUserIsAdmin(currentACL): + if not (currentACL.get('admin', 0) == 1): return ACLManager.loadErrorJson('status', 0) ip_address = data.get('ip_address')