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)
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 @@ class preFlightsChecks:
##
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 @@ class preFlightsChecks:
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

View File

@@ -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,

View File

@@ -92,12 +92,14 @@ class MailServerManager:
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)

View File

@@ -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,

View File

@@ -440,14 +440,11 @@ class cPanelImporter:
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)

View File

@@ -16,6 +16,8 @@ from processUtilities import ProcessUtilities
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 @@ class mailUtilities:
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:

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.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 = {

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

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

View File

@@ -231,9 +231,10 @@ $("#listFail").hide();
app.controller('listWebsites', function ($scope, $http) {
url = "/websites/submitWebsiteListing";
$scope.currentPage = 1;
$scope.recordsToShow = 10;
var data = {page: 1};
$scope.getFurtherWebsitesFromDB = function () {
var config = {
headers: {
@@ -241,38 +242,13 @@ app.controller('listWebsites', function ($scope, $http) {
}
};
$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) {
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
var data = {
page: $scope.currentPage,
recordsToShow: $scope.recordsToShow
};
var data = {page: pageNumber};
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;