From d83c5a998d41a19a2b4baf44775ff4e6dd839098 Mon Sep 17 00:00:00 2001 From: usmannasir Date: Fri, 1 Nov 2024 14:46:53 +0400 Subject: [PATCH] bug fix: email list function --- CyberCP/secMiddleware.py | 5 +++++ api/views.py | 1 - backup/views.py | 1 - cloudAPI/views.py | 11 +++++++---- mailServer/mailserverManager.py | 3 ++- 5 files changed, 14 insertions(+), 7 deletions(-) diff --git a/CyberCP/secMiddleware.py b/CyberCP/secMiddleware.py index 0b66c6ed1..28f81112d 100755 --- a/CyberCP/secMiddleware.py +++ b/CyberCP/secMiddleware.py @@ -39,6 +39,8 @@ def __call__(self, request): or pathActual.endswith('/webhook') or pathActual.startswith('/cloudAPI') or pathActual.endswith('/gitNotify'): pass else: + if os.path.exists(ProcessUtilities.debugPath): + logging.writeToFile(f'Request needs session : {pathActual}') try: val = request.session['userID'] except: @@ -95,6 +97,9 @@ def __call__(self, request): if bool(request.body): try: + if os.path.exists(ProcessUtilities.debugPath): + logging.writeToFile('Request body detected.. scanning') + # logging.writeToFile(request.body) data = json.loads(request.body) for key, value in data.items(): diff --git a/api/views.py b/api/views.py index 0c12c1e56..17b54f9bf 100755 --- a/api/views.py +++ b/api/views.py @@ -48,7 +48,6 @@ def verifyConn(request): data_ret = {"verifyConn": 0} json_data = json.dumps(data_ret) return HttpResponse(json_data) - except BaseException as msg: data_ret = {'verifyConn': 0, 'error_message': str(msg)} json_data = json.dumps(data_ret) diff --git a/backup/views.py b/backup/views.py index 7f0317f39..6ba514f61 100755 --- a/backup/views.py +++ b/backup/views.py @@ -11,7 +11,6 @@ from loginSystem.views import loadLoginPage import os from plogical.CyberCPLogFileWriter import CyberCPLogFileWriter as logging -from django.shortcuts import HttpResponse from django.views.decorators.csrf import csrf_exempt def loadBackupHome(request): diff --git a/cloudAPI/views.py b/cloudAPI/views.py index bb426f82b..9a4023bd6 100755 --- a/cloudAPI/views.py +++ b/cloudAPI/views.py @@ -24,10 +24,13 @@ def router(request): if admin.api == 0: return cm.ajaxPre(0, 'API Access Disabled.') - if cm.verifyLogin(request)[0] == 1: - pass - else: - return cm.verifyLogin(request)[1] + try: + if cm.verifyLogin(request)[0] == 1: + pass + else: + return cm.verifyLogin(request)[1] + except BaseException as msg: + return cm.ajaxPre(0, f"Something went wrong during token processing. ErrorL {str(msg)}") ## Debug Log diff --git a/mailServer/mailserverManager.py b/mailServer/mailserverManager.py index 61c8e1d5c..dc9e99f76 100755 --- a/mailServer/mailserverManager.py +++ b/mailServer/mailserverManager.py @@ -560,7 +560,8 @@ def fetchEmails(self): if os.path.exists(postfixMapPath): - postfixMapData = open(postfixMapPath, 'r').read() + postfixMapData = open(postfixMapPath, 'r', encoding='utf-8').read() + if postfixMapData.find(selectedDomain) == -1: mailConfigured = 0