diff --git a/install/install.py b/install/install.py index e700395ab..e6399ea01 100755 --- a/install/install.py +++ b/install/install.py @@ -952,7 +952,7 @@ def download_install_CyberPanel(self, mysqlPassword, mysql): os.chdir(self.path) - command = "wget http://cyberpanel.sh/CyberPanel.1.8.9.tar.gz" + command = "wget http://cyberpanel.sh/CyberPanel.1.9.0.tar.gz" #command = "wget http://cyberpanel.sh/CyberPanelTemp.tar.gz" preFlightsChecks.call(command, self.distro, '[download_install_CyberPanel]', 'CyberPanel Download', @@ -961,7 +961,7 @@ def download_install_CyberPanel(self, mysqlPassword, mysql): ## count = 0 - command = "tar zxf CyberPanel.1.8.9.tar.gz" + command = "tar zxf CyberPanel.1.9.0.tar.gz" #command = "tar zxf CyberPanelTemp.tar.gz" preFlightsChecks.call(command, self.distro, '[download_install_CyberPanel]', 'Extract CyberPanel',1, 1, os.EX_OSERR) @@ -1053,8 +1053,8 @@ def download_install_CyberPanel(self, mysqlPassword, mysql): try: path = "/usr/local/CyberCP/version.txt" writeToFile = open(path, 'w') - writeToFile.writelines('1.8\n') - writeToFile.writelines('9') + writeToFile.writelines('1.9\n') + writeToFile.writelines('0') writeToFile.close() except: pass diff --git a/loginSystem/views.py b/loginSystem/views.py index 67b6e74fd..4ae220be5 100755 --- a/loginSystem/views.py +++ b/loginSystem/views.py @@ -218,7 +218,7 @@ def loadLoginPage(request): firstName="Cyber",lastName="Panel", acl=acl, token=token) admin.save() - vers = version(currentVersion="1.8", build=9) + vers = version(currentVersion="1.9", build=0) vers.save() package = Package(admin=admin, packageName="Default", diskSpace=1000, diff --git a/mailServer/mailserverManager.py b/mailServer/mailserverManager.py index 9e59f2ba3..8fd7fd010 100755 --- a/mailServer/mailserverManager.py +++ b/mailServer/mailserverManager.py @@ -92,12 +92,14 @@ def submitEmailCreation(self): userName = data['username'] password = data['passwordByPass'] + admin = Administrator.objects.get(pk=userID) if ACLManager.checkOwnership(domainName, admin, currentACL) == 1: pass else: return ACLManager.loadErrorJson() + ## Create email entry result = mailUtilities.createEmailAccount(domainName, userName, password) diff --git a/plogical/adminPass.py b/plogical/adminPass.py index f1bb879c6..1d969c7f2 100755 --- a/plogical/adminPass.py +++ b/plogical/adminPass.py @@ -31,7 +31,7 @@ def main(): firstName="Cyber", lastName="Panel", acl=acl, token=token) admin.save() - vers = version(currentVersion="1.8", build=9) + vers = version(currentVersion="1.9", build=0) vers.save() package = Package(admin=admin, packageName="Default", diskSpace=1000, diff --git a/plogical/cPanelImporter.py b/plogical/cPanelImporter.py index afcaf9a82..6d0c3b66b 100644 --- a/plogical/cPanelImporter.py +++ b/plogical/cPanelImporter.py @@ -440,14 +440,11 @@ def CreateChildDomains(self): movePath = '%s/homedir/public_html/%s' % ( CompletPathToExtractedArchive, ChildDocRoot.replace(self.documentRoot, '', 1).replace('/', '')) - print movePath - if os.path.exists(movePath): shutil.move(movePath, path) else: movePath = '%s/homedir/%s' % ( CompletPathToExtractedArchive, ChildDocRoot.split('/')[-1].replace(self.documentRoot, '', 1).replace('/', '')) - print movePath shutil.move(movePath, path) command = 'chown -R %s:%s %s' % (externalApp, externalApp, path) diff --git a/plogical/mailUtilities.py b/plogical/mailUtilities.py index 801db1ad9..ab621f863 100755 --- a/plogical/mailUtilities.py +++ b/plogical/mailUtilities.py @@ -16,6 +16,8 @@ import os, getpass import hashlib import bcrypt +import getpass + try: from mailServer.models import Domains, EUsers from emailPremium.models import DomainLimits, EmailLimits @@ -113,7 +115,7 @@ def createEmailAccount(domain, userName, password): execPath = "/usr/local/CyberCP/bin/python2 /usr/local/CyberCP/plogical/mailUtilities.py" execPath = execPath + " AfterEffects --domain " + domain - if os.getlogin() == 'root': + if getpass.getuser() == 'root': ## This is the case when cPanel Importer is running and token is not present in enviroment. ProcessUtilities.normalExecutioner(execPath) else: diff --git a/static/backup/backup.js b/static/backup/backup.js old mode 100755 new mode 100644 index 3648f61bd..9c158422b --- a/static/backup/backup.js +++ b/static/backup/backup.js @@ -680,6 +680,7 @@ app.controller('scheduleBackup', function ($scope, $http, $timeout) { $scope.couldNotConnect = true; $scope.scheduleFreq = true; $scope.scheduleBtn = true; + $scope.localPath = true; populateCurrentRecords(); @@ -691,6 +692,12 @@ app.controller('scheduleBackup', function ($scope, $http, $timeout) { $scope.scheduleFreq = false; $scope.scheduleBtn = true; + if($scope.backupDest === 'Home'){ + $scope.localPath = false; + }else{ + $scope.localPath = true; + } + }; $scope.scheduleBtnView = function () { @@ -719,6 +726,7 @@ app.controller('scheduleBackup', function ($scope, $http, $timeout) { var data = { backupDest: $scope.backupDest, backupFreq: $scope.backupFreq, + localPath: $scope.localPathValue }; var config = { diff --git a/static/dns/dns.js b/static/dns/dns.js old mode 100755 new mode 100644 index 61d498f84..6cf85f89b --- a/static/dns/dns.js +++ b/static/dns/dns.js @@ -5,80 +5,77 @@ /* Java script code to create NS */ -app.controller('createNameserver', function($scope,$http) { +app.controller('createNameserver', function ($scope, $http) { - $scope.createNameserverLoading = true; - $scope.nameserverCreationFailed = true; - $scope.nameserverCreated = true; - $scope.couldNotConnect = true; - - $scope.createNameserverFunc = function(){ - - var domainForNS = $scope.domainForNS; + $scope.createNameserverLoading = true; + $scope.nameserverCreationFailed = true; + $scope.nameserverCreated = true; + $scope.couldNotConnect = true; - var ns1 = $scope.firstNS; - var ns2 = $scope.secondNS; + $scope.createNameserverFunc = function () { - var firstNSIP = $scope.firstNSIP; - var secondNSIP = $scope.secondNSIP; + var domainForNS = $scope.domainForNS; + var ns1 = $scope.firstNS; + var ns2 = $scope.secondNS; - url = "/dns/NSCreation"; + var firstNSIP = $scope.firstNSIP; + var secondNSIP = $scope.secondNSIP; - var data = { - domainForNS:domainForNS, - ns1:ns1, - ns2:ns2, - firstNSIP:firstNSIP, - secondNSIP:secondNSIP, - }; - var config = { - headers : { - 'X-CSRFToken': getCookie('csrftoken') - } - }; + url = "/dns/NSCreation"; + var data = { + domainForNS: domainForNS, + ns1: ns1, + ns2: ns2, + firstNSIP: firstNSIP, + secondNSIP: secondNSIP, + }; + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; - $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas); + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); - function ListInitialDatas(response) { + function ListInitialDatas(response) { - if(response.data.NSCreation === 1){ - $scope.createNameserverLoading = true; - $scope.nameserverCreationFailed = true; - $scope.nameserverCreated = false; - $scope.couldNotConnect = true; + if (response.data.NSCreation === 1) { + $scope.createNameserverLoading = true; + $scope.nameserverCreationFailed = true; + $scope.nameserverCreated = false; + $scope.couldNotConnect = true; - $scope.nameServerTwo = $scope.firstNS; - $scope.nameServerOne = $scope.secondNS; - } - else{ - $scope.createNameserverLoading = true; - $scope.nameserverCreationFailed = false; - $scope.nameserverCreated = true; - $scope.couldNotConnect = true; + $scope.nameServerTwo = $scope.firstNS; + $scope.nameServerOne = $scope.secondNS; - $scope.errorMessage = response.data.error_message; - } + } else { + $scope.createNameserverLoading = true; + $scope.nameserverCreationFailed = false; + $scope.nameserverCreated = true; + $scope.couldNotConnect = true; - } - function cantLoadInitialDatas(response) { - $scope.createNameserverLoading = true; - $scope.nameserverCreationFailed = true; - $scope.nameserverCreated = true; - $scope.couldNotConnect = false; + $scope.errorMessage = response.data.error_message; + } - } + } - }; + function cantLoadInitialDatas(response) { + $scope.createNameserverLoading = true; + $scope.nameserverCreationFailed = true; + $scope.nameserverCreated = true; + $scope.couldNotConnect = false; + } + }; }); @@ -87,68 +84,65 @@ app.controller('createNameserver', function($scope,$http) { /* Java script code to create DNS Zone */ -app.controller('createDNSZone', function($scope,$http) { +app.controller('createDNSZone', function ($scope, $http) { - $scope.createDNSZoneLoading = true; - $scope.dnsZoneCreationFailed = true; - $scope.dnsZoneCreated = true; - $scope.couldNotConnect = true; - - $scope.createDNSZone = function(){ - - var zoneDomain = $scope.zoneDomain; + $scope.createDNSZoneLoading = true; + $scope.dnsZoneCreationFailed = true; + $scope.dnsZoneCreated = true; + $scope.couldNotConnect = true; + $scope.createDNSZone = function () { - url = "/dns/zoneCreation"; + var zoneDomain = $scope.zoneDomain; - var data = { - zoneDomain:zoneDomain, - }; - var config = { - headers : { - 'X-CSRFToken': getCookie('csrftoken') - } - }; + url = "/dns/zoneCreation"; + var data = { + zoneDomain: zoneDomain, + }; + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; - $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas); + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); - function ListInitialDatas(response) { + function ListInitialDatas(response) { - if(response.data.zoneCreation === 1){ - $scope.createDNSZoneLoading = true; - $scope.dnsZoneCreationFailed = true; - $scope.dnsZoneCreated = false; - $scope.couldNotConnect = true; - $scope.zoneDomain = $scope.zoneDomain; + if (response.data.zoneCreation === 1) { + $scope.createDNSZoneLoading = true; + $scope.dnsZoneCreationFailed = true; + $scope.dnsZoneCreated = false; + $scope.couldNotConnect = true; - } - else{ - $scope.createDNSZoneLoading = true; - $scope.dnsZoneCreationFailed = false; - $scope.dnsZoneCreated = true; - $scope.couldNotConnect = true; + $scope.zoneDomain = $scope.zoneDomain; - $scope.errorMessage = response.data.error_message; - } + } else { + $scope.createDNSZoneLoading = true; + $scope.dnsZoneCreationFailed = false; + $scope.dnsZoneCreated = true; + $scope.couldNotConnect = true; - } - function cantLoadInitialDatas(response) { - $scope.createDNSZoneLoading = true; - $scope.dnsZoneCreationFailed = true; - $scope.dnsZoneCreated = true; - $scope.couldNotConnect = false; + $scope.errorMessage = response.data.error_message; + } - } + } - }; + function cantLoadInitialDatas(response) { + $scope.createDNSZoneLoading = true; + $scope.dnsZoneCreationFailed = true; + $scope.dnsZoneCreated = true; + $scope.couldNotConnect = false; + } + }; }); @@ -158,456 +152,492 @@ app.controller('createDNSZone', function($scope,$http) { /* Java script code to create DNS Zone */ -app.controller('addModifyDNSRecords', function($scope,$http) { - - $scope.addRecordsBox = true; - $scope.currentRecords = true; - $scope.canNotFetchRecords = true; - $scope.recordsFetched = true; - $scope.recordDeleted = true; - $scope.recordAdded = true; - $scope.couldNotConnect = true; - $scope.recordsLoading = true; - $scope.recordDeleted = true; - $scope.couldNotDeleteRecords = true; - $scope.couldNotAddRecord = true; - $scope.recordValueDefault = false; - - // Hide records boxes - $(".aaaaRecord").hide(); - $(".cNameRecord").hide(); - $(".mxRecord").hide(); - $(".txtRecord").hide(); - $(".spfRecord").hide(); - $(".nsRecord").hide(); - $(".soaRecord").hide(); - $(".srvRecord").hide(); - $(".caaRecord").hide(); - - - - - - var currentSelection = "aRecord"; - $("#"+currentSelection).addClass("active"); - - $scope.fetchRecordsTabs = function (recordType) { - $("#"+currentSelection).removeClass("active"); - $("."+currentSelection).hide(); - $scope.recordsLoading = false; - currentSelection = recordType; - $("#"+currentSelection).addClass("active"); - $("."+currentSelection).show(); - populateCurrentRecords(); - }; - - - - $scope.fetchRecords = function(){ - $scope.recordsLoading = false; - $scope.addRecordsBox = false; - populateCurrentRecords(); - }; - - - $scope.addDNSRecord = function(type){ - - $scope.recordsLoading = false; - - - url = "/dns/addDNSRecord"; - - - // Record specific values - - var data = {}; - - if(type === "MX"){ - data.selectedZone = $scope.selectedZone; - data.recordName = $scope.recordName; - data.recordContentMX = $scope.recordContentMX; - data.priority = $scope.priority; - data.ttl = $scope.ttl; - data.recordType = type; - } - else if(type === "A"){ - - data.selectedZone = $scope.selectedZone; - data.recordName = $scope.recordName; - data.recordContentA = $scope.recordContentA; - data.ttl = $scope.ttl; - data.recordType = type; - - } - else if(type === "AAAA"){ - data.selectedZone = $scope.selectedZone; - data.recordName = $scope.recordName; - data.recordContentAAAA = $scope.recordContentAAAA; - data.ttl = $scope.ttl; - data.recordType = type; - } - else if(type === "CNAME"){ - data.selectedZone = $scope.selectedZone; - data.recordName = $scope.recordName; - data.recordContentCNAME = $scope.recordContentCNAME; - data.ttl = $scope.ttl; - data.recordType = type; - } - else if(type === "SPF"){ - data.selectedZone = $scope.selectedZone; - data.recordName = $scope.recordName; - data.recordContentSPF = $scope.recordContentSPF; - data.ttl = $scope.ttl; - data.recordType = type; - } - else if(type === "SOA"){ - data.selectedZone = $scope.selectedZone; - data.recordName = $scope.selectedZone; - data.recordContentSOA = $scope.recordContentSOA; - data.ttl = $scope.ttl; - data.recordType = type; - } - else if(type === "TXT"){ - data.selectedZone = $scope.selectedZone; - data.recordName = $scope.recordName; - data.recordContentTXT = $scope.recordContentTXT; - data.ttl = $scope.ttl; - data.recordType = type; - } - else if(type === "NS"){ - data.selectedZone = $scope.selectedZone; - data.recordName = $scope.selectedZone; - data.recordContentNS = $scope.recordContentNS; - data.ttl = $scope.ttl; - data.recordType = type; - } - else if(type === "SRV"){ - data.selectedZone = $scope.selectedZone; - data.recordName = $scope.recordName; - data.recordContentSRV = $scope.recordContentSRV; - data.priority = $scope.priority; - data.ttl = $scope.ttl; - data.recordType = type; - }else if(type === "CAA"){ - data.selectedZone = $scope.selectedZone; - data.recordName = $scope.recordName; - data.recordContentCAA = $scope.recordContentCAA; - data.ttl = $scope.ttl; - data.recordType = type; - } +app.controller('addModifyDNSRecords', function ($scope, $http) { + + $scope.addRecordsBox = true; + $scope.currentRecords = true; + $scope.canNotFetchRecords = true; + $scope.recordsFetched = true; + $scope.recordDeleted = true; + $scope.recordAdded = true; + $scope.couldNotConnect = true; + $scope.recordsLoading = true; + $scope.recordDeleted = true; + $scope.couldNotDeleteRecords = true; + $scope.couldNotAddRecord = true; + $scope.recordValueDefault = false; + + // Hide records boxes + $(".aaaaRecord").hide(); + $(".cNameRecord").hide(); + $(".mxRecord").hide(); + $(".txtRecord").hide(); + $(".spfRecord").hide(); + $(".nsRecord").hide(); + $(".soaRecord").hide(); + $(".srvRecord").hide(); + $(".caaRecord").hide(); + + + var currentSelection = "aRecord"; + $("#" + currentSelection).addClass("active"); + + $scope.fetchRecordsTabs = function (recordType) { + $("#" + currentSelection).removeClass("active"); + $("." + currentSelection).hide(); + $scope.recordsLoading = false; + currentSelection = recordType; + $("#" + currentSelection).addClass("active"); + $("." + currentSelection).show(); + populateCurrentRecords(); + }; + + + $scope.fetchRecords = function () { + $scope.recordsLoading = false; + $scope.addRecordsBox = false; + populateCurrentRecords(); + }; + + + $scope.addDNSRecord = function (type) { + + $scope.recordsLoading = false; + + + url = "/dns/addDNSRecord"; + + + // Record specific values + + var data = {}; + + if (type === "MX") { + data.selectedZone = $scope.selectedZone; + data.recordName = $scope.recordName; + data.recordContentMX = $scope.recordContentMX; + data.priority = $scope.priority; + data.ttl = $scope.ttl; + data.recordType = type; + } else if (type === "A") { + + data.selectedZone = $scope.selectedZone; + data.recordName = $scope.recordName; + data.recordContentA = $scope.recordContentA; + data.ttl = $scope.ttl; + data.recordType = type; + + } else if (type === "AAAA") { + data.selectedZone = $scope.selectedZone; + data.recordName = $scope.recordName; + data.recordContentAAAA = $scope.recordContentAAAA; + data.ttl = $scope.ttl; + data.recordType = type; + } else if (type === "CNAME") { + data.selectedZone = $scope.selectedZone; + data.recordName = $scope.recordName; + data.recordContentCNAME = $scope.recordContentCNAME; + data.ttl = $scope.ttl; + data.recordType = type; + } else if (type === "SPF") { + data.selectedZone = $scope.selectedZone; + data.recordName = $scope.recordName; + data.recordContentSPF = $scope.recordContentSPF; + data.ttl = $scope.ttl; + data.recordType = type; + } else if (type === "SOA") { + data.selectedZone = $scope.selectedZone; + data.recordName = $scope.selectedZone; + data.recordContentSOA = $scope.recordContentSOA; + data.ttl = $scope.ttl; + data.recordType = type; + } else if (type === "TXT") { + data.selectedZone = $scope.selectedZone; + data.recordName = $scope.recordName; + data.recordContentTXT = $scope.recordContentTXT; + data.ttl = $scope.ttl; + data.recordType = type; + } else if (type === "NS") { + data.selectedZone = $scope.selectedZone; + data.recordName = $scope.selectedZone; + data.recordContentNS = $scope.recordContentNS; + data.ttl = $scope.ttl; + data.recordType = type; + } else if (type === "SRV") { + data.selectedZone = $scope.selectedZone; + data.recordName = $scope.recordName; + data.recordContentSRV = $scope.recordContentSRV; + data.priority = $scope.priority; + data.ttl = $scope.ttl; + data.recordType = type; + } else if (type === "CAA") { + data.selectedZone = $scope.selectedZone; + data.recordName = $scope.recordName; + data.recordContentCAA = $scope.recordContentCAA; + data.ttl = $scope.ttl; + data.recordType = type; + } + + + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; + + + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); + + + function ListInitialDatas(response) { + + + if (response.data.add_status === 1) { + + + populateCurrentRecords(); + + $scope.canNotFetchRecords = true; + $scope.recordsFetched = false; + $scope.recordDeleted = true; + $scope.recordAdded = false; + $scope.couldNotConnect = true; + $scope.couldNotAddRecord = true; + $scope.recordsLoading = true; + } else { + $scope.recordsFetched = true; + $scope.recordDeleted = true; + $scope.recordAdded = true; + $scope.couldNotConnect = true; + $scope.recordsLoading = true; + $scope.couldNotAddRecord = false; + $scope.errorMessage = response.data.error_message; + } + } - var config = { - headers : { - 'X-CSRFToken': getCookie('csrftoken') - } - }; + function cantLoadInitialDatas(response) { + $scope.addRecordsBox = true; + $scope.currentRecords = true; + $scope.canNotFetchRecords = true; + $scope.recordsFetched = true; + $scope.recordDeleted = true; + $scope.recordAdded = true; + $scope.couldNotConnect = false; + $scope.couldNotAddRecord = true; - $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas); + } - function ListInitialDatas(response) { + }; - if(response.data.add_status === 1){ + function populateCurrentRecords() { + var selectedZone = $scope.selectedZone; - populateCurrentRecords(); - - $scope.canNotFetchRecords = true; - $scope.recordsFetched = false; - $scope.recordDeleted = true; - $scope.recordAdded = false; - $scope.couldNotConnect = true; - $scope.couldNotAddRecord = true; - $scope.recordsLoading = true; - - - } - else{ + url = "/dns/getCurrentRecordsForDomain"; - $scope.recordsFetched = true; - $scope.recordDeleted = true; - $scope.recordAdded = true; - $scope.couldNotConnect = true; - $scope.recordsLoading = true; - $scope.couldNotAddRecord = false; + var data = { + selectedZone: selectedZone, + currentSelection: currentSelection + }; - $scope.errorMessage = response.data.error_message; - } + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; - } - function cantLoadInitialDatas(response) { - $scope.addRecordsBox = true; - $scope.currentRecords = true; - $scope.canNotFetchRecords = true; - $scope.recordsFetched = true; - $scope.recordDeleted = true; - $scope.recordAdded = true; - $scope.couldNotConnect = false; - $scope.couldNotAddRecord = true; + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); + function ListInitialDatas(response) { + if (response.data.fetchStatus === 1) { - } + $scope.records = JSON.parse(response.data.data); - }; + $scope.currentRecords = false; + $scope.canNotFetchRecords = true; + $scope.recordsFetched = false; + $scope.recordDeleted = true; + $scope.recordAdded = true; + $scope.couldNotConnect = true; + $scope.recordsLoading = true; + $scope.couldNotAddRecord = true; + $scope.domainFeteched = $scope.selectedZone; + } else { - function populateCurrentRecords(){ + $scope.addRecordsBox = true; + $scope.currentRecords = true; + $scope.canNotFetchRecords = false; + $scope.recordsFetched = true; + $scope.recordDeleted = true; + $scope.recordAdded = true; + $scope.couldNotConnect = true; + $scope.recordsLoading = true; + $scope.couldNotAddRecord = true; - var selectedZone = $scope.selectedZone; + $scope.errorMessage = response.data.error_message; + } - url = "/dns/getCurrentRecordsForDomain"; + } - var data = { - selectedZone:selectedZone, - currentSelection:currentSelection - }; + function cantLoadInitialDatas(response) { - var config = { - headers : { - 'X-CSRFToken': getCookie('csrftoken') - } - }; + $scope.addRecordsBox = true; + $scope.currentRecords = true; + $scope.canNotFetchRecords = true; + $scope.recordsFetched = true; + $scope.recordDeleted = true; + $scope.recordAdded = true; + $scope.couldNotConnect = false; + $scope.couldNotAddRecord = true; + } - $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas); + }; - function ListInitialDatas(response) { - if(response.data.fetchStatus === 1){ + $scope.deleteRecord = function (id) { - $scope.records = JSON.parse(response.data.data); - $scope.currentRecords = false; - $scope.canNotFetchRecords = true; - $scope.recordsFetched = false; - $scope.recordDeleted = true; - $scope.recordAdded = true; - $scope.couldNotConnect = true; - $scope.recordsLoading = true; - $scope.couldNotAddRecord = true; + var selectedZone = $scope.selectedZone; - $scope.domainFeteched = $scope.selectedZone; + url = "/dns/deleteDNSRecord"; - } - else{ + var data = { + id: id, + }; - $scope.addRecordsBox = true; - $scope.currentRecords = true; - $scope.canNotFetchRecords = false; - $scope.recordsFetched = true; - $scope.recordDeleted = true; - $scope.recordAdded = true; - $scope.couldNotConnect = true; - $scope.recordsLoading = true; - $scope.couldNotAddRecord = true; + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; - $scope.errorMessage = response.data.error_message; - } - } - function cantLoadInitialDatas(response) { + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); - $scope.addRecordsBox = true; - $scope.currentRecords = true; - $scope.canNotFetchRecords = true; - $scope.recordsFetched = true; - $scope.recordDeleted = true; - $scope.recordAdded = true; - $scope.couldNotConnect = false; - $scope.couldNotAddRecord = true; + function ListInitialDatas(response) { - } - }; + if (response.data.delete_status == 1) { - $scope.deleteRecord = function(id){ + $scope.addRecordsBox = false; + $scope.currentRecords = false; + $scope.canNotFetchRecords = true; + $scope.recordsFetched = true; + $scope.recordDeleted = false; + $scope.recordAdded = true; + $scope.couldNotConnect = true; + $scope.recordsLoading = true; + $scope.recordDeleted = true; + $scope.couldNotDeleteRecords = true; + $scope.couldNotAddRecord = true; + populateCurrentRecords(); - var selectedZone = $scope.selectedZone; - url = "/dns/deleteDNSRecord"; + } else { - var data = { - id:id, - }; + $scope.addRecordsBox = true; + $scope.currentRecords = true; + $scope.canNotFetchRecords = true; + $scope.recordsFetched = false; + $scope.recordDeleted = true; + $scope.recordAdded = true; + $scope.couldNotConnect = true; + $scope.recordsLoading = true; + $scope.recordDeleted = true; + $scope.couldNotDeleteRecords = false; + $scope.couldNotAddRecord = true; - var config = { - headers : { - 'X-CSRFToken': getCookie('csrftoken') - } - }; + $scope.errorMessage = response.data.error_message; - $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas); + } + } - function ListInitialDatas(response) { + function cantLoadInitialDatas(response) { + $scope.addRecordsBox = false; + $scope.currentRecords = false; + $scope.canNotFetchRecords = true; + $scope.recordsFetched = true; + $scope.recordDeleted = true; + $scope.recordAdded = true; + $scope.couldNotConnect = false; + $scope.recordsLoading = true; + $scope.recordDeleted = true; + $scope.couldNotDeleteRecords = true; + $scope.couldNotAddRecord = true; - if(response.data.delete_status == 1){ + } - $scope.addRecordsBox = false; - $scope.currentRecords = false; - $scope.canNotFetchRecords = true; - $scope.recordsFetched = true; - $scope.recordDeleted = false; - $scope.recordAdded = true; - $scope.couldNotConnect = true; - $scope.recordsLoading = true; - $scope.recordDeleted = true; - $scope.couldNotDeleteRecords = true; - $scope.couldNotAddRecord = true; - populateCurrentRecords(); + }; +}); - } - else{ +/* Java script code to delete DNS Zone */ - $scope.addRecordsBox = true; - $scope.currentRecords = true; - $scope.canNotFetchRecords = true; - $scope.recordsFetched = false; - $scope.recordDeleted = true; - $scope.recordAdded = true; - $scope.couldNotConnect = true; - $scope.recordsLoading = true; - $scope.recordDeleted = true; - $scope.couldNotDeleteRecords = false; - $scope.couldNotAddRecord = true; +/* Java script code to delete DNS Zone */ - $scope.errorMessage = response.data.error_message; +app.controller('deleteDNSZone', function ($scope, $http) { + $scope.deleteZoneButton = true; + $scope.deleteFailure = true; + $scope.deleteSuccess = true; + $scope.couldNotConnect = true; - } - } - function cantLoadInitialDatas(response) { + $scope.deleteZone = function () { + $scope.deleteZoneButton = false; + $scope.deleteFailure = true; + $scope.deleteSuccess = true; + }; - $scope.addRecordsBox = false; - $scope.currentRecords = false; - $scope.canNotFetchRecords = true; - $scope.recordsFetched = true; - $scope.recordDeleted = true; - $scope.recordAdded = true; - $scope.couldNotConnect = false; - $scope.recordsLoading = true; - $scope.recordDeleted = true; - $scope.couldNotDeleteRecords = true; - $scope.couldNotAddRecord = true; + $scope.deleteZoneFinal = function () { + var zoneDomain = $scope.selectedZone; + url = "/dns/submitZoneDeletion"; - } + var data = { + zoneDomain: zoneDomain, + }; + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; - }; + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); -}); + function ListInitialDatas(response) { -/* Java script code to delete DNS Zone */ + if (response.data.delete_status == 1) { + $scope.deleteZoneButton = true; + $scope.deleteFailure = true; + $scope.deleteSuccess = false; + $scope.couldNotConnect = true; + + $scope.deletedZone = $scope.selectedZone; -/* Java script code to delete DNS Zone */ -app.controller('deleteDNSZone', function($scope,$http) { + } else { $scope.deleteZoneButton = true; - $scope.deleteFailure = true; + $scope.deleteFailure = false; $scope.deleteSuccess = true; $scope.couldNotConnect = true; + $scope.errorMessage = response.data.error_message; - $scope.deleteZone = function(){ - $scope.deleteZoneButton = false; - $scope.deleteFailure = true; - $scope.deleteSuccess = true; - }; + } - $scope.deleteZoneFinal = function(){ + } - var zoneDomain = $scope.selectedZone; + function cantLoadInitialDatas(response) { + $scope.deleteZoneButton = true; + $scope.deleteFailure = true; + $scope.deleteSuccess = true; + $scope.couldNotConnect = false; - url = "/dns/submitZoneDeletion"; - var data = { - zoneDomain:zoneDomain, - }; + } - var config = { - headers : { - 'X-CSRFToken': getCookie('csrftoken') - } - }; + }; +}); - $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas); - +/* Java script code to delete DNS Zone */ - function ListInitialDatas(response) { +/* Java script code to create NS */ - if(response.data.delete_status == 1){ +app.controller('configureDefaultNameservers', function ($scope, $http) { - $scope.deleteZoneButton = true; - $scope.deleteFailure = true; - $scope.deleteSuccess = false; - $scope.couldNotConnect = true; - $scope.deletedZone = $scope.selectedZone; + $scope.cyberPanelLoading = true; + $scope.saveNSConfigurations = function () { + $scope.cyberPanelLoading = false; - } - else{ - $scope.deleteZoneButton = true; - $scope.deleteFailure = false; - $scope.deleteSuccess = true; - $scope.couldNotConnect = true; + url = "/dns/saveNSConfigurations"; - $scope.errorMessage = response.data.error_message; + var data = { + firstNS: $scope.firstNS, + secondNS: $scope.secondNS, + thirdNS: $scope.thirdNS, + forthNS: $scope.forthNS, + }; - } + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; - } - function cantLoadInitialDatas(response) { - $scope.deleteZoneButton = true; - $scope.deleteFailure = true; - $scope.deleteSuccess = true; - $scope.couldNotConnect = false; + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); - } + function ListInitialDatas(response) { + $scope.cyberPanelLoading = true; + if (response.data.status === 1) { + new PNotify({ + title: 'Success!', + text: 'Default nameservers saved.', + type: 'success' + }); + } else { + new PNotify({ + title: 'Operation Failed!', + text: response.data.error_message, + type: 'error' + }); + } - }; + } + function cantLoadInitialDatas(response) { + $scope.cyberPanelLoading = true; + new PNotify({ + title: 'Operation Failed!', + text: 'Could not connect to server, please refresh this page', + type: 'error' + }); + } + }; }); - -/* Java script code to delete DNS Zone */ \ No newline at end of file +/* Java script code to create NS ends here */ \ No newline at end of file diff --git a/static/dockerManager/dockerManager.js b/static/dockerManager/dockerManager.js index 728de63d9..4ae67f3f1 100644 --- a/static/dockerManager/dockerManager.js +++ b/static/dockerManager/dockerManager.js @@ -788,7 +788,6 @@ app.controller('viewContainer', function ($scope, $http) { $scope.cAction = function (action) { $('#actionLoading').show(); - console.log($scope.cName) url = "/docker/doContainerAction"; var data = {name: $scope.cName, action: action}; var config = { diff --git a/static/websiteFunctions/websiteFunctions.js b/static/websiteFunctions/websiteFunctions.js index f9fc0908a..9f22ba41b 100644 --- a/static/websiteFunctions/websiteFunctions.js +++ b/static/websiteFunctions/websiteFunctions.js @@ -231,37 +231,10 @@ $("#listFail").hide(); app.controller('listWebsites', function ($scope, $http) { - url = "/websites/submitWebsiteListing"; + $scope.currentPage = 1; + $scope.recordsToShow = 10; - var data = {page: 1}; - - var config = { - headers: { - 'X-CSRFToken': getCookie('csrftoken') - } - }; - - $http.post(url, data, config).then(ListInitialData, cantLoadInitialData); - - - function ListInitialData(response) { - - if (response.data.listWebSiteStatus === 1) { - var finalData = JSON.parse(response.data.data); - $scope.WebSitesList = finalData; - $scope.pagination = response.data.pagination; - $("#listFail").hide(); - } else { - $("#listFail").fadeIn(); - $scope.errorMessage = response.data.error_message; - - } - } - - function cantLoadInitialData(response) { - } - - $scope.getFurtherWebsitesFromDB = function (pageNumber) { + $scope.getFurtherWebsitesFromDB = function () { var config = { headers: { @@ -269,10 +242,13 @@ app.controller('listWebsites', function ($scope, $http) { } }; - var data = {page: pageNumber}; + var data = { + page: $scope.currentPage, + recordsToShow: $scope.recordsToShow + }; - dataurl = "/websites/submitWebsiteListing"; + dataurl = "/websites/fetchWebsitesList"; $http.post(dataurl, data, config).then(ListInitialData, cantLoadInitialData); @@ -280,8 +256,9 @@ app.controller('listWebsites', function ($scope, $http) { function ListInitialData(response) { if (response.data.listWebSiteStatus === 1) { - var finalData = JSON.parse(response.data.data); - $scope.WebSitesList = finalData; + $scope.WebSitesList = JSON.parse(response.data.data); + $scope.pagination = response.data.pagination; + $scope.clients = JSON.parse(response.data.data); $("#listFail").hide(); } else { $("#listFail").fadeIn(); @@ -291,11 +268,11 @@ app.controller('listWebsites', function ($scope, $http) { } function cantLoadInitialData(response) { - console.log("not good"); } }; + $scope.getFurtherWebsitesFromDB(); $scope.cyberPanelLoading = true;