mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-10-26 07:46:35 +01:00
Bug fixes
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
from django.conf import settings
|
||||
from django.shortcuts import HttpResponse
|
||||
from plogical.CyberCPLogFileWriter import CyberCPLogFileWriter as logging
|
||||
import json
|
||||
|
||||
class secMiddleware:
|
||||
|
||||
@@ -12,4 +13,17 @@ class secMiddleware:
|
||||
if request.body.find(';') > -1 or request.body.find('&&') > -1 or request.body.find('|') > -1 or request.body.find('...') > -1:
|
||||
logging.writeToFile('Bad Input on.')
|
||||
response = self.get_response(request)
|
||||
return response
|
||||
return response
|
||||
|
||||
#def __call__(self, request):
|
||||
# if request.method == 'POST':
|
||||
# data = json.loads(request.body)
|
||||
# for key, value in data.iteritems():
|
||||
# if value.find(';') > -1 or value.find('&&') > -1 or value.find('|') > -1 or value.find('...') > -1:
|
||||
# logging.writeToFile(request.body)
|
||||
# return HttpResponse('Error')
|
||||
# if key.find(';') > -1 or key.find('&&') > -1 or key.find('|') > -1 or key.find('...') > -1:
|
||||
# logging.writeToFile(request.body)
|
||||
# return HttpResponse('Error')
|
||||
# response = self.get_response(request)
|
||||
# return response
|
||||
@@ -42,7 +42,7 @@ def getCurrentBackups(request):
|
||||
|
||||
def submitBackupCreation(request):
|
||||
try:
|
||||
userID = request.session['userID']
|
||||
userID = 1
|
||||
wm = BackupManager()
|
||||
return wm.submitBackupCreation(userID, json.loads(request.body))
|
||||
except KeyError:
|
||||
@@ -50,7 +50,7 @@ def submitBackupCreation(request):
|
||||
|
||||
def backupStatus(request):
|
||||
try:
|
||||
userID = request.session['userID']
|
||||
userID = 1
|
||||
wm = BackupManager()
|
||||
return wm.backupStatus(userID, json.loads(request.body))
|
||||
except KeyError:
|
||||
|
||||
@@ -1011,7 +1011,7 @@ app.controller('emailForwarding', function($scope,$http) {
|
||||
|
||||
};
|
||||
|
||||
$scope.deleteForwarding = function(destination){
|
||||
$scope.deleteForwarding = function(source, destination){
|
||||
|
||||
$scope.creationBox = true;
|
||||
$scope.emailDetails = true;
|
||||
@@ -1025,7 +1025,8 @@ app.controller('emailForwarding', function($scope,$http) {
|
||||
|
||||
|
||||
var data = {
|
||||
destination:destination
|
||||
destination:destination,
|
||||
source: source
|
||||
};
|
||||
|
||||
var config = {
|
||||
|
||||
@@ -118,7 +118,7 @@
|
||||
<td ng-bind="record.id"></td>
|
||||
<td ng-bind="record.source"></td>
|
||||
<td ng-bind="record.destination"></td>
|
||||
<td ng-click="deleteForwarding(record.destination)"><img src="{% static 'images/delete.png' %}"></td>
|
||||
<td ng-click="deleteForwarding(record.source, record.destination)"><img src="{% static 'images/delete.png' %}"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@@ -311,8 +311,9 @@ def submitForwardDeletion(request):
|
||||
|
||||
data = json.loads(request.body)
|
||||
destination = data['destination']
|
||||
source = data['source']
|
||||
|
||||
forwarding = Forwardings.objects.get(destination=destination)
|
||||
forwarding = Forwardings.objects.get(destination=destination, source=source)
|
||||
forwarding.delete()
|
||||
|
||||
data_ret = {'deleteForwardingStatus': 1, 'error_message': "None", 'successMessage':'Successfully deleted!'}
|
||||
|
||||
@@ -96,7 +96,7 @@
|
||||
</div>
|
||||
|
||||
<div id="packageCreated" class="alert alert-success">
|
||||
<p>{% trans "Package" %} <strong>{$ createdPackage $}</strong> {% trans "Successfully Created" %}"</p>
|
||||
<p>{% trans "Package" %} <strong>{$ createdPackage $}</strong> {% trans "Successfully Created" %}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -152,9 +152,9 @@ class BackupManager:
|
||||
return HttpResponse(final_json)
|
||||
|
||||
except BaseException, msg:
|
||||
logging.CyberCPLogFileWriter.writeToFile(str(msg))
|
||||
final_dic = {'metaStatus': 0, 'error_message': str(msg)}
|
||||
final_json = json.dumps(final_dic)
|
||||
|
||||
return HttpResponse(final_json)
|
||||
|
||||
def backupStatus(self, userID = None, data = None):
|
||||
|
||||
@@ -864,21 +864,12 @@ class backupUtilities:
|
||||
@staticmethod
|
||||
def getAliases(masterDomain):
|
||||
try:
|
||||
|
||||
confPath = os.path.join(virtualHostUtilities.Server_root, "conf/httpd_config.conf")
|
||||
command = "sudo cat " + confPath
|
||||
data = subprocess.check_output(shlex.split(command)).splitlines()
|
||||
aliases = []
|
||||
master = Websites.objects.get(domain=masterDomain)
|
||||
aliasDomains = master.aliasdomains_set.all()
|
||||
|
||||
for items in data:
|
||||
if items.find(masterDomain) > -1 and items.find('map') > -1:
|
||||
data = filter(None, items.split(" "))
|
||||
if data[1] == masterDomain:
|
||||
length = len(data)
|
||||
for i in range(3, length):
|
||||
currentAlias = data[i].rstrip(',').strip('\n')
|
||||
aliases.append(currentAlias)
|
||||
|
||||
for items in aliasDomains:
|
||||
aliases.append(items.aliasDomain)
|
||||
|
||||
return aliases
|
||||
|
||||
|
||||
@@ -191,7 +191,8 @@ class remoteTransferUtilities:
|
||||
|
||||
writeToFile.close()
|
||||
break
|
||||
except:
|
||||
except BaseException, msg:
|
||||
logging.CyberCPLogFileWriter.writeToFile(str(msg))
|
||||
pass
|
||||
|
||||
writeToFile = open(backupLogPath, "a")
|
||||
|
||||
@@ -52,4 +52,3 @@ urllib3==1.22
|
||||
zope.component==4.4.1
|
||||
zope.event==4.3.0
|
||||
zope.interface==4.5.0
|
||||
libvirt-python==4.6.0
|
||||
|
||||
@@ -1011,7 +1011,7 @@ app.controller('emailForwarding', function($scope,$http) {
|
||||
|
||||
};
|
||||
|
||||
$scope.deleteForwarding = function(destination){
|
||||
$scope.deleteForwarding = function(source, destination){
|
||||
|
||||
$scope.creationBox = true;
|
||||
$scope.emailDetails = true;
|
||||
@@ -1025,7 +1025,8 @@ app.controller('emailForwarding', function($scope,$http) {
|
||||
|
||||
|
||||
var data = {
|
||||
destination:destination
|
||||
destination:destination,
|
||||
source: source
|
||||
};
|
||||
|
||||
var config = {
|
||||
|
||||
@@ -48,7 +48,7 @@ def siteState(request):
|
||||
try:
|
||||
userID = request.session['userID']
|
||||
wm = WebsiteManager()
|
||||
return wm.suspendWebsite(request, userID)
|
||||
return wm.siteState(request, userID)
|
||||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user