bug fix while creating email

This commit is contained in:
Usman Nasir
2019-08-25 05:25:48 +05:00
parent cbf4f2f5fe
commit a5bf6ca60a
10 changed files with 534 additions and 519 deletions

View File

@@ -952,7 +952,7 @@ class preFlightsChecks:
os.chdir(self.path) 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" #command = "wget http://cyberpanel.sh/CyberPanelTemp.tar.gz"
preFlightsChecks.call(command, self.distro, '[download_install_CyberPanel]', preFlightsChecks.call(command, self.distro, '[download_install_CyberPanel]',
'CyberPanel Download', 'CyberPanel Download',
@@ -961,7 +961,7 @@ class preFlightsChecks:
## ##
count = 0 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" #command = "tar zxf CyberPanelTemp.tar.gz"
preFlightsChecks.call(command, self.distro, '[download_install_CyberPanel]', preFlightsChecks.call(command, self.distro, '[download_install_CyberPanel]',
'Extract CyberPanel',1, 1, os.EX_OSERR) 'Extract CyberPanel',1, 1, os.EX_OSERR)
@@ -1053,8 +1053,8 @@ class preFlightsChecks:
try: try:
path = "/usr/local/CyberCP/version.txt" path = "/usr/local/CyberCP/version.txt"
writeToFile = open(path, 'w') writeToFile = open(path, 'w')
writeToFile.writelines('1.8\n') writeToFile.writelines('1.9\n')
writeToFile.writelines('9') writeToFile.writelines('0')
writeToFile.close() writeToFile.close()
except: except:
pass pass

View File

@@ -218,7 +218,7 @@ def loadLoginPage(request):
firstName="Cyber",lastName="Panel", acl=acl, token=token) firstName="Cyber",lastName="Panel", acl=acl, token=token)
admin.save() admin.save()
vers = version(currentVersion="1.8", build=9) vers = version(currentVersion="1.9", build=0)
vers.save() vers.save()
package = Package(admin=admin, packageName="Default", diskSpace=1000, package = Package(admin=admin, packageName="Default", diskSpace=1000,

View File

@@ -92,12 +92,14 @@ class MailServerManager:
userName = data['username'] userName = data['username']
password = data['passwordByPass'] password = data['passwordByPass']
admin = Administrator.objects.get(pk=userID) admin = Administrator.objects.get(pk=userID)
if ACLManager.checkOwnership(domainName, admin, currentACL) == 1: if ACLManager.checkOwnership(domainName, admin, currentACL) == 1:
pass pass
else: else:
return ACLManager.loadErrorJson() return ACLManager.loadErrorJson()
## Create email entry ## Create email entry
result = mailUtilities.createEmailAccount(domainName, userName, password) result = mailUtilities.createEmailAccount(domainName, userName, password)

View File

@@ -31,7 +31,7 @@ def main():
firstName="Cyber", lastName="Panel", acl=acl, token=token) firstName="Cyber", lastName="Panel", acl=acl, token=token)
admin.save() admin.save()
vers = version(currentVersion="1.8", build=9) vers = version(currentVersion="1.9", build=0)
vers.save() vers.save()
package = Package(admin=admin, packageName="Default", diskSpace=1000, package = Package(admin=admin, packageName="Default", diskSpace=1000,

View File

@@ -440,14 +440,11 @@ class cPanelImporter:
movePath = '%s/homedir/public_html/%s' % ( movePath = '%s/homedir/public_html/%s' % (
CompletPathToExtractedArchive, ChildDocRoot.replace(self.documentRoot, '', 1).replace('/', '')) CompletPathToExtractedArchive, ChildDocRoot.replace(self.documentRoot, '', 1).replace('/', ''))
print movePath
if os.path.exists(movePath): if os.path.exists(movePath):
shutil.move(movePath, path) shutil.move(movePath, path)
else: else:
movePath = '%s/homedir/%s' % ( movePath = '%s/homedir/%s' % (
CompletPathToExtractedArchive, ChildDocRoot.split('/')[-1].replace(self.documentRoot, '', 1).replace('/', '')) CompletPathToExtractedArchive, ChildDocRoot.split('/')[-1].replace(self.documentRoot, '', 1).replace('/', ''))
print movePath
shutil.move(movePath, path) shutil.move(movePath, path)
command = 'chown -R %s:%s %s' % (externalApp, externalApp, path) command = 'chown -R %s:%s %s' % (externalApp, externalApp, path)

View File

@@ -16,6 +16,8 @@ from processUtilities import ProcessUtilities
import os, getpass import os, getpass
import hashlib import hashlib
import bcrypt import bcrypt
import getpass
try: try:
from mailServer.models import Domains, EUsers from mailServer.models import Domains, EUsers
from emailPremium.models import DomainLimits, EmailLimits from emailPremium.models import DomainLimits, EmailLimits
@@ -113,7 +115,7 @@ class mailUtilities:
execPath = "/usr/local/CyberCP/bin/python2 /usr/local/CyberCP/plogical/mailUtilities.py" execPath = "/usr/local/CyberCP/bin/python2 /usr/local/CyberCP/plogical/mailUtilities.py"
execPath = execPath + " AfterEffects --domain " + domain 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. ## This is the case when cPanel Importer is running and token is not present in enviroment.
ProcessUtilities.normalExecutioner(execPath) ProcessUtilities.normalExecutioner(execPath)
else: else:

8
static/backup/backup.js Executable file → Normal file
View File

@@ -680,6 +680,7 @@ app.controller('scheduleBackup', function ($scope, $http, $timeout) {
$scope.couldNotConnect = true; $scope.couldNotConnect = true;
$scope.scheduleFreq = true; $scope.scheduleFreq = true;
$scope.scheduleBtn = true; $scope.scheduleBtn = true;
$scope.localPath = true;
populateCurrentRecords(); populateCurrentRecords();
@@ -691,6 +692,12 @@ app.controller('scheduleBackup', function ($scope, $http, $timeout) {
$scope.scheduleFreq = false; $scope.scheduleFreq = false;
$scope.scheduleBtn = true; $scope.scheduleBtn = true;
if($scope.backupDest === 'Home'){
$scope.localPath = false;
}else{
$scope.localPath = true;
}
}; };
$scope.scheduleBtnView = function () { $scope.scheduleBtnView = function () {
@@ -719,6 +726,7 @@ app.controller('scheduleBackup', function ($scope, $http, $timeout) {
var data = { var data = {
backupDest: $scope.backupDest, backupDest: $scope.backupDest,
backupFreq: $scope.backupFreq, backupFreq: $scope.backupFreq,
localPath: $scope.localPathValue
}; };
var config = { var config = {

232
static/dns/dns.js Executable file → Normal file
View File

@@ -5,14 +5,14 @@
/* Java script code to create NS */ /* Java script code to create NS */
app.controller('createNameserver', function($scope,$http) { app.controller('createNameserver', function ($scope, $http) {
$scope.createNameserverLoading = true; $scope.createNameserverLoading = true;
$scope.nameserverCreationFailed = true; $scope.nameserverCreationFailed = true;
$scope.nameserverCreated = true; $scope.nameserverCreated = true;
$scope.couldNotConnect = true; $scope.couldNotConnect = true;
$scope.createNameserverFunc = function(){ $scope.createNameserverFunc = function () {
var domainForNS = $scope.domainForNS; var domainForNS = $scope.domainForNS;
@@ -26,28 +26,27 @@ app.controller('createNameserver', function($scope,$http) {
url = "/dns/NSCreation"; url = "/dns/NSCreation";
var data = { var data = {
domainForNS:domainForNS, domainForNS: domainForNS,
ns1:ns1, ns1: ns1,
ns2:ns2, ns2: ns2,
firstNSIP:firstNSIP, firstNSIP: firstNSIP,
secondNSIP:secondNSIP, secondNSIP: secondNSIP,
}; };
var config = { var config = {
headers : { headers: {
'X-CSRFToken': getCookie('csrftoken') '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){ if (response.data.NSCreation === 1) {
$scope.createNameserverLoading = true; $scope.createNameserverLoading = true;
$scope.nameserverCreationFailed = true; $scope.nameserverCreationFailed = true;
$scope.nameserverCreated = false; $scope.nameserverCreated = false;
@@ -57,8 +56,7 @@ app.controller('createNameserver', function($scope,$http) {
$scope.nameServerTwo = $scope.firstNS; $scope.nameServerTwo = $scope.firstNS;
$scope.nameServerOne = $scope.secondNS; $scope.nameServerOne = $scope.secondNS;
} } else {
else{
$scope.createNameserverLoading = true; $scope.createNameserverLoading = true;
$scope.nameserverCreationFailed = false; $scope.nameserverCreationFailed = false;
$scope.nameserverCreated = true; $scope.nameserverCreated = true;
@@ -68,6 +66,7 @@ app.controller('createNameserver', function($scope,$http) {
} }
} }
function cantLoadInitialDatas(response) { function cantLoadInitialDatas(response) {
$scope.createNameserverLoading = true; $scope.createNameserverLoading = true;
$scope.nameserverCreationFailed = true; $scope.nameserverCreationFailed = true;
@@ -79,22 +78,20 @@ app.controller('createNameserver', function($scope,$http) {
}; };
}); });
/* Java script code to create NS ends here */ /* Java script code to create NS ends here */
/* Java script code to create DNS Zone */ /* Java script code to create DNS Zone */
app.controller('createDNSZone', function($scope,$http) { app.controller('createDNSZone', function ($scope, $http) {
$scope.createDNSZoneLoading = true; $scope.createDNSZoneLoading = true;
$scope.dnsZoneCreationFailed = true; $scope.dnsZoneCreationFailed = true;
$scope.dnsZoneCreated = true; $scope.dnsZoneCreated = true;
$scope.couldNotConnect = true; $scope.couldNotConnect = true;
$scope.createDNSZone = function(){ $scope.createDNSZone = function () {
var zoneDomain = $scope.zoneDomain; var zoneDomain = $scope.zoneDomain;
@@ -102,24 +99,23 @@ app.controller('createDNSZone', function($scope,$http) {
url = "/dns/zoneCreation"; url = "/dns/zoneCreation";
var data = { var data = {
zoneDomain:zoneDomain, zoneDomain: zoneDomain,
}; };
var config = { var config = {
headers : { headers: {
'X-CSRFToken': getCookie('csrftoken') '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){ if (response.data.zoneCreation === 1) {
$scope.createDNSZoneLoading = true; $scope.createDNSZoneLoading = true;
$scope.dnsZoneCreationFailed = true; $scope.dnsZoneCreationFailed = true;
$scope.dnsZoneCreated = false; $scope.dnsZoneCreated = false;
@@ -127,8 +123,7 @@ app.controller('createDNSZone', function($scope,$http) {
$scope.zoneDomain = $scope.zoneDomain; $scope.zoneDomain = $scope.zoneDomain;
} } else {
else{
$scope.createDNSZoneLoading = true; $scope.createDNSZoneLoading = true;
$scope.dnsZoneCreationFailed = false; $scope.dnsZoneCreationFailed = false;
$scope.dnsZoneCreated = true; $scope.dnsZoneCreated = true;
@@ -138,6 +133,7 @@ app.controller('createDNSZone', function($scope,$http) {
} }
} }
function cantLoadInitialDatas(response) { function cantLoadInitialDatas(response) {
$scope.createDNSZoneLoading = true; $scope.createDNSZoneLoading = true;
$scope.dnsZoneCreationFailed = true; $scope.dnsZoneCreationFailed = true;
@@ -149,8 +145,6 @@ app.controller('createDNSZone', function($scope,$http) {
}; };
}); });
/* Java script code to delete DNS Zone */ /* Java script code to delete DNS Zone */
@@ -158,7 +152,7 @@ app.controller('createDNSZone', function($scope,$http) {
/* Java script code to create DNS Zone */ /* Java script code to create DNS Zone */
app.controller('addModifyDNSRecords', function($scope,$http) { app.controller('addModifyDNSRecords', function ($scope, $http) {
$scope.addRecordsBox = true; $scope.addRecordsBox = true;
$scope.currentRecords = true; $scope.currentRecords = true;
@@ -185,32 +179,28 @@ app.controller('addModifyDNSRecords', function($scope,$http) {
$(".caaRecord").hide(); $(".caaRecord").hide();
var currentSelection = "aRecord"; var currentSelection = "aRecord";
$("#"+currentSelection).addClass("active"); $("#" + currentSelection).addClass("active");
$scope.fetchRecordsTabs = function (recordType) { $scope.fetchRecordsTabs = function (recordType) {
$("#"+currentSelection).removeClass("active"); $("#" + currentSelection).removeClass("active");
$("."+currentSelection).hide(); $("." + currentSelection).hide();
$scope.recordsLoading = false; $scope.recordsLoading = false;
currentSelection = recordType; currentSelection = recordType;
$("#"+currentSelection).addClass("active"); $("#" + currentSelection).addClass("active");
$("."+currentSelection).show(); $("." + currentSelection).show();
populateCurrentRecords(); populateCurrentRecords();
}; };
$scope.fetchRecords = function () {
$scope.fetchRecords = function(){
$scope.recordsLoading = false; $scope.recordsLoading = false;
$scope.addRecordsBox = false; $scope.addRecordsBox = false;
populateCurrentRecords(); populateCurrentRecords();
}; };
$scope.addDNSRecord = function(type){ $scope.addDNSRecord = function (type) {
$scope.recordsLoading = false; $scope.recordsLoading = false;
@@ -222,15 +212,14 @@ app.controller('addModifyDNSRecords', function($scope,$http) {
var data = {}; var data = {};
if(type === "MX"){ if (type === "MX") {
data.selectedZone = $scope.selectedZone; data.selectedZone = $scope.selectedZone;
data.recordName = $scope.recordName; data.recordName = $scope.recordName;
data.recordContentMX = $scope.recordContentMX; data.recordContentMX = $scope.recordContentMX;
data.priority = $scope.priority; data.priority = $scope.priority;
data.ttl = $scope.ttl; data.ttl = $scope.ttl;
data.recordType = type; data.recordType = type;
} } else if (type === "A") {
else if(type === "A"){
data.selectedZone = $scope.selectedZone; data.selectedZone = $scope.selectedZone;
data.recordName = $scope.recordName; data.recordName = $scope.recordName;
@@ -238,57 +227,50 @@ app.controller('addModifyDNSRecords', function($scope,$http) {
data.ttl = $scope.ttl; data.ttl = $scope.ttl;
data.recordType = type; data.recordType = type;
} } else if (type === "AAAA") {
else if(type === "AAAA"){
data.selectedZone = $scope.selectedZone; data.selectedZone = $scope.selectedZone;
data.recordName = $scope.recordName; data.recordName = $scope.recordName;
data.recordContentAAAA = $scope.recordContentAAAA; data.recordContentAAAA = $scope.recordContentAAAA;
data.ttl = $scope.ttl; data.ttl = $scope.ttl;
data.recordType = type; data.recordType = type;
} } else if (type === "CNAME") {
else if(type === "CNAME"){
data.selectedZone = $scope.selectedZone; data.selectedZone = $scope.selectedZone;
data.recordName = $scope.recordName; data.recordName = $scope.recordName;
data.recordContentCNAME = $scope.recordContentCNAME; data.recordContentCNAME = $scope.recordContentCNAME;
data.ttl = $scope.ttl; data.ttl = $scope.ttl;
data.recordType = type; data.recordType = type;
} } else if (type === "SPF") {
else if(type === "SPF"){
data.selectedZone = $scope.selectedZone; data.selectedZone = $scope.selectedZone;
data.recordName = $scope.recordName; data.recordName = $scope.recordName;
data.recordContentSPF = $scope.recordContentSPF; data.recordContentSPF = $scope.recordContentSPF;
data.ttl = $scope.ttl; data.ttl = $scope.ttl;
data.recordType = type; data.recordType = type;
} } else if (type === "SOA") {
else if(type === "SOA"){
data.selectedZone = $scope.selectedZone; data.selectedZone = $scope.selectedZone;
data.recordName = $scope.selectedZone; data.recordName = $scope.selectedZone;
data.recordContentSOA = $scope.recordContentSOA; data.recordContentSOA = $scope.recordContentSOA;
data.ttl = $scope.ttl; data.ttl = $scope.ttl;
data.recordType = type; data.recordType = type;
} } else if (type === "TXT") {
else if(type === "TXT"){
data.selectedZone = $scope.selectedZone; data.selectedZone = $scope.selectedZone;
data.recordName = $scope.recordName; data.recordName = $scope.recordName;
data.recordContentTXT = $scope.recordContentTXT; data.recordContentTXT = $scope.recordContentTXT;
data.ttl = $scope.ttl; data.ttl = $scope.ttl;
data.recordType = type; data.recordType = type;
} } else if (type === "NS") {
else if(type === "NS"){
data.selectedZone = $scope.selectedZone; data.selectedZone = $scope.selectedZone;
data.recordName = $scope.selectedZone; data.recordName = $scope.selectedZone;
data.recordContentNS = $scope.recordContentNS; data.recordContentNS = $scope.recordContentNS;
data.ttl = $scope.ttl; data.ttl = $scope.ttl;
data.recordType = type; data.recordType = type;
} } else if (type === "SRV") {
else if(type === "SRV"){
data.selectedZone = $scope.selectedZone; data.selectedZone = $scope.selectedZone;
data.recordName = $scope.recordName; data.recordName = $scope.recordName;
data.recordContentSRV = $scope.recordContentSRV; data.recordContentSRV = $scope.recordContentSRV;
data.priority = $scope.priority; data.priority = $scope.priority;
data.ttl = $scope.ttl; data.ttl = $scope.ttl;
data.recordType = type; data.recordType = type;
}else if(type === "CAA"){ } else if (type === "CAA") {
data.selectedZone = $scope.selectedZone; data.selectedZone = $scope.selectedZone;
data.recordName = $scope.recordName; data.recordName = $scope.recordName;
data.recordContentCAA = $scope.recordContentCAA; data.recordContentCAA = $scope.recordContentCAA;
@@ -297,24 +279,20 @@ app.controller('addModifyDNSRecords', function($scope,$http) {
} }
var config = { var config = {
headers : { headers: {
'X-CSRFToken': getCookie('csrftoken') '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.add_status === 1){ if (response.data.add_status === 1) {
populateCurrentRecords(); populateCurrentRecords();
@@ -328,8 +306,7 @@ app.controller('addModifyDNSRecords', function($scope,$http) {
$scope.recordsLoading = true; $scope.recordsLoading = true;
} } else {
else{
$scope.recordsFetched = true; $scope.recordsFetched = true;
$scope.recordDeleted = true; $scope.recordDeleted = true;
@@ -342,6 +319,7 @@ app.controller('addModifyDNSRecords', function($scope,$http) {
} }
} }
function cantLoadInitialDatas(response) { function cantLoadInitialDatas(response) {
$scope.addRecordsBox = true; $scope.addRecordsBox = true;
@@ -354,37 +332,34 @@ app.controller('addModifyDNSRecords', function($scope,$http) {
$scope.couldNotAddRecord = true; $scope.couldNotAddRecord = true;
} }
}; };
function populateCurrentRecords() {
function populateCurrentRecords(){
var selectedZone = $scope.selectedZone; var selectedZone = $scope.selectedZone;
url = "/dns/getCurrentRecordsForDomain"; url = "/dns/getCurrentRecordsForDomain";
var data = { var data = {
selectedZone:selectedZone, selectedZone: selectedZone,
currentSelection:currentSelection currentSelection: currentSelection
}; };
var config = { var config = {
headers : { headers: {
'X-CSRFToken': getCookie('csrftoken') '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.fetchStatus === 1){ if (response.data.fetchStatus === 1) {
$scope.records = JSON.parse(response.data.data); $scope.records = JSON.parse(response.data.data);
@@ -399,8 +374,7 @@ app.controller('addModifyDNSRecords', function($scope,$http) {
$scope.domainFeteched = $scope.selectedZone; $scope.domainFeteched = $scope.selectedZone;
} } else {
else{
$scope.addRecordsBox = true; $scope.addRecordsBox = true;
$scope.currentRecords = true; $scope.currentRecords = true;
@@ -416,6 +390,7 @@ app.controller('addModifyDNSRecords', function($scope,$http) {
} }
} }
function cantLoadInitialDatas(response) { function cantLoadInitialDatas(response) {
$scope.addRecordsBox = true; $scope.addRecordsBox = true;
@@ -433,7 +408,7 @@ app.controller('addModifyDNSRecords', function($scope,$http) {
}; };
$scope.deleteRecord = function(id){ $scope.deleteRecord = function (id) {
var selectedZone = $scope.selectedZone; var selectedZone = $scope.selectedZone;
@@ -441,24 +416,23 @@ app.controller('addModifyDNSRecords', function($scope,$http) {
url = "/dns/deleteDNSRecord"; url = "/dns/deleteDNSRecord";
var data = { var data = {
id:id, id: id,
}; };
var config = { var config = {
headers : { headers: {
'X-CSRFToken': getCookie('csrftoken') '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.delete_status == 1){ if (response.data.delete_status == 1) {
$scope.addRecordsBox = false; $scope.addRecordsBox = false;
@@ -476,9 +450,7 @@ app.controller('addModifyDNSRecords', function($scope,$http) {
populateCurrentRecords(); populateCurrentRecords();
} else {
}
else{
$scope.addRecordsBox = true; $scope.addRecordsBox = true;
$scope.currentRecords = true; $scope.currentRecords = true;
@@ -499,6 +471,7 @@ app.controller('addModifyDNSRecords', function($scope,$http) {
} }
} }
function cantLoadInitialDatas(response) { function cantLoadInitialDatas(response) {
$scope.addRecordsBox = false; $scope.addRecordsBox = false;
@@ -514,24 +487,20 @@ app.controller('addModifyDNSRecords', function($scope,$http) {
$scope.couldNotAddRecord = true; $scope.couldNotAddRecord = true;
} }
}; };
}); });
/* Java script code to delete DNS Zone */ /* Java script code to delete DNS Zone */
/* Java script code to delete DNS Zone */ /* Java script code to delete DNS Zone */
app.controller('deleteDNSZone', function($scope,$http) { app.controller('deleteDNSZone', function ($scope, $http) {
$scope.deleteZoneButton = true; $scope.deleteZoneButton = true;
$scope.deleteFailure = true; $scope.deleteFailure = true;
@@ -539,13 +508,13 @@ app.controller('deleteDNSZone', function($scope,$http) {
$scope.couldNotConnect = true; $scope.couldNotConnect = true;
$scope.deleteZone = function(){ $scope.deleteZone = function () {
$scope.deleteZoneButton = false; $scope.deleteZoneButton = false;
$scope.deleteFailure = true; $scope.deleteFailure = true;
$scope.deleteSuccess = true; $scope.deleteSuccess = true;
}; };
$scope.deleteZoneFinal = function(){ $scope.deleteZoneFinal = function () {
var zoneDomain = $scope.selectedZone; var zoneDomain = $scope.selectedZone;
@@ -553,24 +522,23 @@ app.controller('deleteDNSZone', function($scope,$http) {
url = "/dns/submitZoneDeletion"; url = "/dns/submitZoneDeletion";
var data = { var data = {
zoneDomain:zoneDomain, zoneDomain: zoneDomain,
}; };
var config = { var config = {
headers : { headers: {
'X-CSRFToken': getCookie('csrftoken') '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.delete_status == 1){ if (response.data.delete_status == 1) {
$scope.deleteZoneButton = true; $scope.deleteZoneButton = true;
$scope.deleteFailure = true; $scope.deleteFailure = true;
@@ -580,8 +548,7 @@ app.controller('deleteDNSZone', function($scope,$http) {
$scope.deletedZone = $scope.selectedZone; $scope.deletedZone = $scope.selectedZone;
} } else {
else{
$scope.deleteZoneButton = true; $scope.deleteZoneButton = true;
$scope.deleteFailure = false; $scope.deleteFailure = false;
@@ -593,6 +560,7 @@ app.controller('deleteDNSZone', function($scope,$http) {
} }
} }
function cantLoadInitialDatas(response) { function cantLoadInitialDatas(response) {
$scope.deleteZoneButton = true; $scope.deleteZoneButton = true;
@@ -606,8 +574,70 @@ app.controller('deleteDNSZone', function($scope,$http) {
}; };
}); });
/* Java script code to delete DNS Zone */ /* Java script code to delete DNS Zone */
/* Java script code to create NS */
app.controller('configureDefaultNameservers', function ($scope, $http) {
$scope.cyberPanelLoading = true;
$scope.saveNSConfigurations = function () {
$scope.cyberPanelLoading = false;
url = "/dns/saveNSConfigurations";
var data = {
firstNS: $scope.firstNS,
secondNS: $scope.secondNS,
thirdNS: $scope.thirdNS,
forthNS: $scope.forthNS,
};
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
$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 create NS ends here */

View File

@@ -788,7 +788,6 @@ app.controller('viewContainer', function ($scope, $http) {
$scope.cAction = function (action) { $scope.cAction = function (action) {
$('#actionLoading').show(); $('#actionLoading').show();
console.log($scope.cName)
url = "/docker/doContainerAction"; url = "/docker/doContainerAction";
var data = {name: $scope.cName, action: action}; var data = {name: $scope.cName, action: action};
var config = { var config = {

View File

@@ -231,9 +231,10 @@ $("#listFail").hide();
app.controller('listWebsites', function ($scope, $http) { app.controller('listWebsites', function ($scope, $http) {
url = "/websites/submitWebsiteListing"; $scope.currentPage = 1;
$scope.recordsToShow = 10;
var data = {page: 1}; $scope.getFurtherWebsitesFromDB = function () {
var config = { var config = {
headers: { headers: {
@@ -241,38 +242,13 @@ app.controller('listWebsites', function ($scope, $http) {
} }
}; };
$http.post(url, data, config).then(ListInitialData, cantLoadInitialData); var data = {
page: $scope.currentPage,
recordsToShow: $scope.recordsToShow
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) {
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
}; };
var data = {page: pageNumber};
dataurl = "/websites/fetchWebsitesList";
dataurl = "/websites/submitWebsiteListing";
$http.post(dataurl, data, config).then(ListInitialData, cantLoadInitialData); $http.post(dataurl, data, config).then(ListInitialData, cantLoadInitialData);
@@ -280,8 +256,9 @@ app.controller('listWebsites', function ($scope, $http) {
function ListInitialData(response) { function ListInitialData(response) {
if (response.data.listWebSiteStatus === 1) { if (response.data.listWebSiteStatus === 1) {
var finalData = JSON.parse(response.data.data); $scope.WebSitesList = JSON.parse(response.data.data);
$scope.WebSitesList = finalData; $scope.pagination = response.data.pagination;
$scope.clients = JSON.parse(response.data.data);
$("#listFail").hide(); $("#listFail").hide();
} else { } else {
$("#listFail").fadeIn(); $("#listFail").fadeIn();
@@ -291,11 +268,11 @@ app.controller('listWebsites', function ($scope, $http) {
} }
function cantLoadInitialData(response) { function cantLoadInitialData(response) {
console.log("not good");
} }
}; };
$scope.getFurtherWebsitesFromDB();
$scope.cyberPanelLoading = true; $scope.cyberPanelLoading = true;