diff --git a/packages/views.py b/packages/views.py
index f1b786ce4..fa26f1017 100644
--- a/packages/views.py
+++ b/packages/views.py
@@ -74,6 +74,7 @@ def submitPackage(request):
packageDatabases = int(data['dataBases'])
ftpAccounts = int(data['ftpAccounts'])
emails = int(data['emails'])
+ allowedDomains = int(data['allowedDomains'])
admin = Administrator.objects.get(pk=request.session['userID'])
@@ -81,7 +82,7 @@ def submitPackage(request):
packageName = admin.userName+"_"+packageName
package = Package(admin=admin, packageName=packageName, diskSpace=packageSpace,
- bandwidth=packageBandwidth, ftpAccounts=ftpAccounts, dataBases=packageDatabases,emailAccounts=emails)
+ bandwidth=packageBandwidth, ftpAccounts=ftpAccounts, dataBases=packageDatabases,emailAccounts=emails,allowedDomains=allowedDomains)
package.save()
@@ -171,7 +172,7 @@ def submitModify(request):
emails = modifyPack.emailAccounts
data_ret = {'emails':emails,'modifyStatus': 1,'error_message': "None",
- "diskSpace":diskSpace,"bandwidth":bandwidth,"ftpAccounts":ftpAccounts,"dataBases":dataBases}
+ "diskSpace":diskSpace,"bandwidth":bandwidth,"ftpAccounts":ftpAccounts,"dataBases":dataBases,"allowedDomains":modifyPack.allowedDomains}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
@@ -201,6 +202,7 @@ def saveChanges(request):
modifyPack.ftpAccounts = data['ftpAccounts']
modifyPack.dataBases = data['dataBases']
modifyPack.emailAccounts = data['emails']
+ modifyPack.allowedDomains = data['allowedDomains']
modifyPack.save()
data_ret = {'saveStatus': 1,'error_message': "None"}
diff --git a/plogical/backupUtilities.py b/plogical/backupUtilities.py
index afb0b82cb..4b6cb2acd 100644
--- a/plogical/backupUtilities.py
+++ b/plogical/backupUtilities.py
@@ -10,7 +10,7 @@ import tarfile
from multiprocessing import Process
import json
import requests
-
+import signal
class backupUtilities:
@@ -27,18 +27,25 @@ class backupUtilities:
status.close()
count = 0
+ dbCheck = 0
for items in meta:
if count==0:
- domainName = items.strip('\n')
+ domainName = items.split('-')[0]
make_archive(tempStoragePath+"/public_html", 'gztar', "/home/"+domainName+"/public_html")
count = count + 1
else:
- dbName = items.split('-')[0]
- status = open(backupPath + 'status', "w")
- status.write(backupName + "\n")
- status.write("Backing up database: "+dbName)
- status.close()
- mysqlUtilities.mysqlUtilities.createDatabaseBackup(dbName,tempStoragePath)
+ if items.find("Databases")>-1:
+ dbCheck = 1
+ continue
+
+ if dbCheck == 1:
+ dbName = items.split('-')[0]
+ status = open(backupPath + 'status', "w")
+ status.write(backupName + "\n")
+ status.write("Backing up database: " + dbName)
+ status.close()
+ mysqlUtilities.mysqlUtilities.createDatabaseBackup(dbName, tempStoragePath)
+
make_archive(backupPath+"/"+backupName, 'gztar', tempStoragePath)
rmtree(tempStoragePath)
@@ -122,7 +129,7 @@ class backupUtilities:
try:
finalData = json.dumps({'backupFile': backupName,"dir":dir})
- r = requests.post("http://localhost:5003/websites/CreateWebsiteFromBackup", data=finalData)
+ r = requests.post("http://localhost:5003/websites/CreateWebsiteFromBackup", data=finalData,verify=False)
data = json.loads(r.text)
if data['createWebSiteStatus'] == 1:
@@ -140,9 +147,6 @@ class backupUtilities:
logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [startRestore]")
return 0
-
-
-
f = open(completPath + '/status')
data = f.read()
status = data.split('\n', 1)[0]
@@ -152,23 +156,80 @@ class backupUtilities:
elif (status == "Website already exists"):
return 0
- ## reading meta file to create databases
+ ########### creating sub/addon/parked domains
+
+ status = open(completPath + '/status', "w")
+ status.write("Creating Child Domains")
+ status.close()
+
+ ## reading meta file to create subdomains
+
+ data = open(completPath + "/meta", 'r').readlines()
+
+ ## extracting master domain for later use
+
+ masterDomain = data[0].split('-')[0]
+ websiteHome = "/home/" + masterDomain + "/public_html"
+
+
+ try:
+ childDomainsCheck = 0
+ for items in data:
+ if items.find("Child Domains") > -1:
+ childDomainsCheck = 1
+ continue
+ if items.find("Databases") > -1:
+ break
+
+ if childDomainsCheck == 1:
+ domain = items.split('-')[0]
+ phpSelection = items.split('-')[1]
+ path = items.split('-')[2].strip("\n")
+
+
+ finalData = json.dumps({'masterDomain': masterDomain, 'domainName': domain,'phpSelection': phpSelection,'path': path,'ssl':0,'restore':1})
+ r = requests.post("http://localhost:5003/websites/submitDomainCreation", data=finalData,
+ verify=False)
+
+ data = json.loads(r.text)
+
+ if data['createWebSiteStatus'] == 1:
+ rmtree(path)
+ continue
+ else:
+ status = open(completPath + '/status', "w")
+ status.write("Not able to create Account and databases, aborting.")
+ status.close()
+ logging.CyberCPLogFileWriter.writeToFile(r.text)
+ return 0
+
+
+ except BaseException, msg:
+ status = open(completPath + '/status', "w")
+ status.write("[201] Not able to create Account and databases, aborting.")
+ status.close()
+ logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [startRestore]")
+ return 0
+
+
+
+
+ ## restoring databases
data = open(completPath + "/meta", 'r').readlines()
- domain = data[0].strip('\n')
- websiteHome = "/home/" + domain + "/public_html"
- check = 0
status = open(completPath + '/status', "w")
status.write("Restoring Databases")
status.close()
+ dbCheck = 0
+
for items in data:
- if check == 0:
- check = check + 1
+ if items.find("Databases") > -1:
+ dbCheck = 1
continue
- else:
+ if dbCheck == 1:
dbData = items.split('-')
mysqlUtilities.mysqlUtilities.restoreDatabaseBackup(dbData[0], completPath, dbData[2].strip('\n'))
@@ -338,13 +399,16 @@ class backupUtilities:
else:
return 0
except BaseException, msg:
- logging.CyberCPLogFileWriter.writeToFile(str(msg) + "[checkIfPostIsUp]")
+ logging.CyberCPLogFileWriter.writeToFile(str(msg) + "[checkIfHostIsUp]")
@staticmethod
def checkConnection(IPAddress):
+
try:
+ backupUtilities.verifyHostKey(IPAddress)
+
expectation = []
expectation.append("password:")
expectation.append("Last login")
@@ -355,44 +419,90 @@ class backupUtilities:
if index == 0:
subprocess.call(['kill', str(checkConn.pid)])
- return 0
+ return [0,"Remote Server is not able to authenticate for transfer to initiate."]
elif index == 1:
subprocess.call(['kill', str(checkConn.pid)])
- return 1
+ return [1, "None"]
else:
subprocess.call(['kill', str(checkConn.pid)])
- return 0
+ return [0, "Remote Server is not able to authenticate for transfer to initiate."]
except pexpect.TIMEOUT, msg:
- logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [checkConnection]")
- return 0
+ logging.CyberCPLogFileWriter.writeToFile("Timeout "+IPAddress+ " [checkConnection]")
+ return [0, "371 Timeout while making connection to this server [checkConnection]"]
except pexpect.EOF, msg:
- logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [checkConnection]")
- return 0
+ logging.CyberCPLogFileWriter.writeToFile("EOF "+IPAddress+ "[checkConnection]")
+ return [0, "374 Remote Server is not able to authenticate for transfer to initiate. [checkConnection]"]
except BaseException, msg:
- logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [checkConnection]")
- return 0
+ logging.CyberCPLogFileWriter.writeToFile(str(msg)+" " +IPAddress+ " [checkConnection]")
+ return [0, "377 Remote Server is not able to authenticate for transfer to initiate. [checkConnection]"]
@staticmethod
def verifyHostKey(IPAddress):
-
try:
+ backupUtilities.host_key_verification(IPAddress)
- expectation = "continue connecting (yes/no)?"
+ password = "hello" ## dumb password, not used anywhere.
+
+ expectation = []
+
+ expectation.append("continue connecting (yes/no)?")
+ expectation.append("password:")
+
+ setupSSHKeys = pexpect.spawn("ssh root@" + IPAddress)
+
+ index = setupSSHKeys.expect(expectation)
+
+ if index == 0:
+ setupSSHKeys.sendline("yes")
+
+ setupSSHKeys.expect("password:")
+ setupSSHKeys.sendline(password)
+
+ expectation = []
+
+ expectation.append("password:")
+ expectation.append(pexpect.EOF)
+
+
+ innerIndex = setupSSHKeys.expect(expectation)
+
+ if innerIndex == 0:
+ setupSSHKeys.kill(signal.SIGTERM)
+ return [1, "None"]
+ elif innerIndex == 1:
+ setupSSHKeys.kill(signal.SIGTERM)
+ return [1, "None"]
+
+ elif index == 1:
+
+ setupSSHKeys.expect("password:")
+ setupSSHKeys.sendline(password)
+
+ expectation = []
+
+ expectation.append("password:")
+ expectation.append(pexpect.EOF)
+
+ innerIndex = setupSSHKeys.expect(expectation)
+
+ if innerIndex == 0:
+ setupSSHKeys.kill(signal.SIGTERM)
+ return [1, "None"]
+ elif innerIndex == 1:
+ setupSSHKeys.kill(signal.SIGTERM)
+ return [1, "None"]
- verifyHostKey = pexpect.spawn("ssh -i /root/.ssh/cyberpanel root@" + IPAddress, timeout=3)
- verifyHostKey.expect(expectation)
- verifyHostKey.sendline("yes")
except pexpect.TIMEOUT, msg:
logging.CyberCPLogFileWriter.writeToFile("Timeout [verifyHostKey]")
- return 0
+ return [0,"Timeout [verifyHostKey]"]
except pexpect.EOF, msg:
logging.CyberCPLogFileWriter.writeToFile("EOF [verifyHostKey]")
- return 0
+ return [0,"EOF [verifyHostKey]"]
except BaseException, msg:
logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [verifyHostKey]")
- return 0
+ return [0,str(msg)+" [verifyHostKey]"]
@staticmethod
diff --git a/plogical/remoteBackup.py b/plogical/remoteBackup.py
index d10c603ab..7af55e95d 100644
--- a/plogical/remoteBackup.py
+++ b/plogical/remoteBackup.py
@@ -197,87 +197,88 @@ class remoteBackup:
for backup in os.listdir(backupDir):
- writeToFile = open(backupLogPath, "a")
-
- writeToFile.writelines("\n")
- writeToFile.writelines("\n")
- writeToFile.writelines("[" + time.strftime(
- "%I-%M-%S-%a-%b-%Y") + "]" + " Starting restore for: "+backup+".\n")
-
- writeToFile.close()
-
if backup.endswith(ext):
- finalData = json.dumps({'backupFile': backup,"dir":dir})
- r = requests.post("http://localhost:5003/backup/submitRestore", data=finalData)
- data = json.loads(r.text)
+ writeToFile = open(backupLogPath, "a")
- if data['restoreStatus'] == 1:
+ writeToFile.writelines("\n")
+ writeToFile.writelines("\n")
+ writeToFile.writelines("[" + time.strftime(
+ "%I-%M-%S-%a-%b-%Y") + "]" + " Starting restore for: "+backup+".\n")
- while (1):
- finalData = json.dumps({'backupFile': backup, "dir": dir})
- r = requests.post("http://localhost:5003/backup/restoreStatus", data=finalData)
- data = json.loads(r.text)
+ writeToFile.close()
- logging.CyberCPLogFileWriter.writeToFile(r.text)
+ if backup.endswith(ext):
+ finalData = json.dumps({'backupFile': backup,"dir":dir})
+ r = requests.post("http://localhost:5003/backup/submitRestore", data=finalData,verify=False)
+ data = json.loads(r.text)
- if data['status'] == "Done":
- writeToFile = open(backupLogPath, "a")
- writeToFile.writelines("\n")
- writeToFile.writelines("\n")
- writeToFile.writelines("[" + time.strftime(
- "%I-%M-%S-%a-%b-%Y") + "]" + " Restore Completed.\n")
- writeToFile.writelines("[" + time.strftime(
- "%I-%M-%S-%a-%b-%Y") + "]" + " #########################################\n")
- writeToFile.close()
- break
- elif data['status'] == "Website already exists":
- writeToFile = open(backupLogPath, "a")
- writeToFile.writelines("\n")
- writeToFile.writelines("\n")
- writeToFile.writelines("[" + time.strftime(
- "%I-%M-%S-%a-%b-%Y") + "]" + " Website associated with this backup already exists.\n")
- writeToFile.writelines("[" + time.strftime(
- "%I-%M-%S-%a-%b-%Y") + "]" + " #########################################\n")
- writeToFile.close()
- logging.CyberCPLogFileWriter.writeToFile(
- "Website associated with this backup already exists")
- break
- elif data['status'] == 0:
- time.sleep(2)
+ if data['restoreStatus'] == 1:
- writeToFile = open(backupLogPath, "a")
- writeToFile.writelines("\n")
- writeToFile.writelines("\n")
- writeToFile.writelines("[" + time.strftime(
- "%I-%M-%S-%a-%b-%Y") + "]" + " Waiting for restore to complete.\n")
- writeToFile.close()
+ while (1):
+ finalData = json.dumps({'backupFile': backup, "dir": dir})
+ r = requests.post("http://localhost:5003/backup/restoreStatus", data=finalData,verify=False)
+ data = json.loads(r.text)
- pass
- elif data['status'] == "Not able to create Account and databases, aborting.":
- writeToFile = open(backupLogPath, "a")
- writeToFile.writelines("\n")
- writeToFile.writelines("\n")
- writeToFile.writelines("[" + time.strftime(
- "%I-%M-%S-%a-%b-%Y") + "]" + " Not able to create Account and databases, aborting.\n")
- writeToFile.writelines("[" + time.strftime(
- "%I-%M-%S-%a-%b-%Y") + "]" + " #########################################\n")
- writeToFile.close()
- logging.CyberCPLogFileWriter.writeToFile(
- "Not able to create Account and databases, aborting.")
- break
- else:
- time.sleep(3)
+ logging.CyberCPLogFileWriter.writeToFile(r.text)
- writeToFile = open(backupLogPath, "a")
- writeToFile.writelines("\n")
- writeToFile.writelines("\n")
- writeToFile.writelines("[" + time.strftime(
- "%I-%M-%S-%a-%b-%Y") + "]" + " Waiting for restore to complete.\n")
- writeToFile.close()
+ if data['status'] == "Done":
+ writeToFile = open(backupLogPath, "a")
+ writeToFile.writelines("\n")
+ writeToFile.writelines("\n")
+ writeToFile.writelines("[" + time.strftime(
+ "%I-%M-%S-%a-%b-%Y") + "]" + " Restore Completed.\n")
+ writeToFile.writelines("[" + time.strftime(
+ "%I-%M-%S-%a-%b-%Y") + "]" + " #########################################\n")
+ writeToFile.close()
+ break
+ elif data['status'] == "Website already exists":
+ writeToFile = open(backupLogPath, "a")
+ writeToFile.writelines("\n")
+ writeToFile.writelines("\n")
+ writeToFile.writelines("[" + time.strftime(
+ "%I-%M-%S-%a-%b-%Y") + "]" + " Website associated with this backup already exists.\n")
+ writeToFile.writelines("[" + time.strftime(
+ "%I-%M-%S-%a-%b-%Y") + "]" + " #########################################\n")
+ writeToFile.close()
+ logging.CyberCPLogFileWriter.writeToFile(
+ "Website associated with this backup already exists")
+ break
+ elif data['status'] == 0:
+ time.sleep(2)
- pass
- else:
- logging.CyberCPLogFileWriter.writeToFile("Could not start restore process for: "+backup)
+ writeToFile = open(backupLogPath, "a")
+ writeToFile.writelines("\n")
+ writeToFile.writelines("\n")
+ writeToFile.writelines("[" + time.strftime(
+ "%I-%M-%S-%a-%b-%Y") + "]" + " Waiting for restore to complete.\n")
+ writeToFile.close()
+
+ pass
+ elif data['status'] == "Not able to create Account and databases, aborting.":
+ writeToFile = open(backupLogPath, "a")
+ writeToFile.writelines("\n")
+ writeToFile.writelines("\n")
+ writeToFile.writelines("[" + time.strftime(
+ "%I-%M-%S-%a-%b-%Y") + "]" + " Not able to create Account and databases, aborting.\n")
+ writeToFile.writelines("[" + time.strftime(
+ "%I-%M-%S-%a-%b-%Y") + "]" + " #########################################\n")
+ writeToFile.close()
+ logging.CyberCPLogFileWriter.writeToFile(
+ "Not able to create Account and databases, aborting.")
+ break
+ else:
+ time.sleep(3)
+
+ writeToFile = open(backupLogPath, "a")
+ writeToFile.writelines("\n")
+ writeToFile.writelines("\n")
+ writeToFile.writelines("[" + time.strftime(
+ "%I-%M-%S-%a-%b-%Y") + "]" + " Waiting for restore to complete.\n")
+ writeToFile.close()
+
+ pass
+ else:
+ logging.CyberCPLogFileWriter.writeToFile("Could not start restore process for: "+backup)
writeToFile = open(backupLogPath, "a")
@@ -360,13 +361,13 @@ class remoteBackup:
"%I-%M-%S-%a-%b-%Y") + "]" + " Backup started for: " + virtualHost + "\n")
finalData = json.dumps({'websiteToBeBacked': virtualHost})
- r = requests.post("http://localhost:5003/backup/submitBackupCreation", data=finalData)
+ r = requests.post("http://localhost:5003/backup/submitBackupCreation", data=finalData,verify=False)
data = json.loads(r.text)
backupPath = data['tempStorage']
while (1):
- r = requests.post("http://localhost:5003/backup/backupStatus", data= finalData)
+ r = requests.post("http://localhost:5003/backup/backupStatus", data= finalData,verify=False)
time.sleep(2)
data = json.loads(r.text)
@@ -428,7 +429,7 @@ class remoteBackup:
finalData = json.dumps({'websiteToBeBacked': virtualHost})
- r = requests.post("http://localhost:5003/backup/submitBackupCreation", data=finalData)
+ r = requests.post("http://localhost:5003/backup/submitBackupCreation", data=finalData,verify=False)
data = json.loads(r.text)
@@ -438,7 +439,7 @@ class remoteBackup:
while (1):
- r = requests.post("http://localhost:5003/backup/backupStatus", data= finalData)
+ r = requests.post("http://localhost:5003/backup/backupStatus", data= finalData,verify=False)
time.sleep(2)
data = json.loads(r.text)
@@ -513,18 +514,25 @@ class remoteBackup:
writeToFile.writelines("\n")
writeToFile.writelines("\n")
- writeToFile.close()
## fix yes/no
- backupUtil.backupUtilities.verifyHostKey(ipAddress)
+ verify = backupUtil.backupUtilities.verifyHostKey(ipAddress)
+
+ ## if verification failed, return with error message
+
+ if verify[0] == 1:
+ pass
+ else:
+ return [0,verify[1]]
if backupUtil.backupUtilities.checkIfHostIsUp(ipAddress) == 1:
- if backupUtil.backupUtilities.checkConnection(ipAddress) != 1:
+ checkConn = backupUtil.backupUtilities.checkConnection(ipAddress)
+ if checkConn[0] == 0:
writeToFile.writelines("[" + time.strftime(
"%I-%M-%S-%a-%b-%Y") + "]" + " Connection to:" + ipAddress + " Failed, please resetup this destination from CyberPanel, aborting." + "\n")
- return [0, "Connection check failed"]
+ return [0, checkConn[1]]
else:
pass
else:
@@ -532,6 +540,8 @@ class remoteBackup:
"%I-%M-%S-%a-%b-%Y") + "]" + " Host:" + ipAddress + " is down, aborting." + "\n")
return [0, "Host is down"]
+ writeToFile.close()
+
p = Process(target=remoteBackup.backupProcess, args=(ipAddress, destination, backupLogPath,dir,accountsToTransfer))
p.start()
@@ -543,6 +553,6 @@ class remoteBackup:
return [1, None]
except BaseException, msg:
- logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [postRemoteTransfer]")
+ logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [remoteTransfer]")
return [0, msg]
diff --git a/plogical/sslUtilities.py b/plogical/sslUtilities.py
index 960a4ba22..8a7693c23 100644
--- a/plogical/sslUtilities.py
+++ b/plogical/sslUtilities.py
@@ -134,12 +134,10 @@ class sslUtilities:
@staticmethod
- def obtainSSLForADomain(virtualHostName,adminEmail):
+ def obtainSSLForADomain(virtualHostName,adminEmail,sslpath):
try:
- sslpath = "/home/" + virtualHostName + "/public_html"
-
#if virtualHostName.count(".")==1:
# command = "certbot certonly -n --agree-tos --email " + adminEmail + " --webroot -w " + sslpath + " -d " + virtualHostName + " -d www." + virtualHostName
#else:
diff --git a/plogical/test.py b/plogical/test.py
index 3feeef13a..6de77b8b9 100644
--- a/plogical/test.py
+++ b/plogical/test.py
@@ -1,29 +1,77 @@
import requests
import json
-def editWPFile():
+import pexpect
+from CyberCPLogFileWriter import CyberCPLogFileWriter as logging
+import time
+from backupUtilities import backupUtilities
+import signal
- finalData = json.dumps({'adminUser': "admin",
- 'adminPass': "1234567",
- 'domainName': "usmannasir.me",
- 'ownerEmail': "admin",
- 'packageName': "Default",
- 'websiteOwner': "usman",
- 'ownerPassword': "9xvps",
- })
- r = requests.post("http://147.135.165.44:8090/api/createWebsite", data=finalData)
- print r.text
+def verifyHostKey(IPAddress):
+ try:
+ backupUtilities.host_key_verification(IPAddress)
-def delwebsite():
+ password = "hello"
- finalData = json.dumps({'adminUser': "admin",
- 'adminPass': "9njZ9Hw6QuJvw4AS6w",
- })
- r = requests.post("https://cyberpanel.extravm.com:8090/api/verifyConn", data=finalData)
- print r.text
+ expectation = []
+
+ expectation.append("continue connecting (yes/no)?")
+ expectation.append("password:")
+
+ setupSSHKeys = pexpect.spawn("ssh root@" + IPAddress)
+
+ index = setupSSHKeys.expect(expectation)
+
+ if index == 0:
+ setupSSHKeys.sendline("yes")
+
+ setupSSHKeys.expect("password:")
+ setupSSHKeys.sendline(password)
+
+ expectation = []
+
+ expectation.append("password:")
+ expectation.append(pexpect.EOF)
-def getKey(ipAddress, password):
- return requests.get('https://api.ipify.org').text
+ innerIndex = setupSSHKeys.expect(expectation)
+
+ if innerIndex == 0:
+ setupSSHKeys.kill(signal.SIGTERM)
+ return [1, "None"]
+ elif innerIndex == 1:
+ setupSSHKeys.kill(signal.SIGTERM)
+ return [1, "None"]
+
+ elif index == 1:
+
+ setupSSHKeys.expect("password:")
+ setupSSHKeys.sendline(password)
+
+ expectation = []
+
+ expectation.append("password:")
+ expectation.append(pexpect.EOF)
+
+ innerIndex = setupSSHKeys.expect(expectation)
+
+ if innerIndex == 0:
+ setupSSHKeys.kill(signal.SIGTERM)
+ return [1, "None"]
+ elif innerIndex == 1:
+ setupSSHKeys.kill(signal.SIGTERM)
+ return [1, "None"]
-print getKey("147.135.165.44","1234567")
\ No newline at end of file
+ except pexpect.TIMEOUT, msg:
+ logging.writeToFile("Timeout [verifyHostKey]")
+ return [0,"Timeout [verifyHostKey]"]
+ except pexpect.EOF, msg:
+ logging.writeToFile("EOF [verifyHostKey]")
+ return [0,"EOF [verifyHostKey]"]
+ except BaseException, msg:
+ logging.writeToFile(str(msg) + " [verifyHostKey]")
+ return [0,str(msg)+" [verifyHostKey]"]
+
+
+
+print verifyHostKey("23.95.216.56")
\ No newline at end of file
diff --git a/plogical/virtualHostUtilities.py b/plogical/virtualHostUtilities.py
index ecefc73b1..154ed5faf 100644
--- a/plogical/virtualHostUtilities.py
+++ b/plogical/virtualHostUtilities.py
@@ -65,6 +65,106 @@ class virtualHostUtilities:
return 0
+ @staticmethod
+ def perHostVirtualConf(vhFile, administratorEmail, phpVersion):
+
+ # General Configurations tab
+
+ try:
+ confFile = open(vhFile, "w+")
+
+ docRoot = "docRoot $VH_ROOT/public_html" + "\n"
+ vhDomain = "vhDomain $VH_NAME" + "\n"
+ adminEmails = "adminEmails " + administratorEmail + "\n"
+ enableGzip = "enableGzip 1" + "\n"
+ enableIpGeo = "enableIpGeo 1" + "\n" + "\n"
+
+ confFile.writelines(docRoot)
+ confFile.writelines(vhDomain)
+ confFile.writelines(adminEmails)
+ confFile.writelines(enableGzip)
+ confFile.writelines(enableIpGeo)
+
+ # Index file settings
+
+ index = "index {" + "\n"
+ userServer = " useServer 0" + "\n"
+ indexFiles = " indexFiles index.php, index.html" + "\n"
+ index_end = "}" + "\n" + "\n"
+
+ confFile.writelines(index)
+ confFile.writelines(userServer)
+ confFile.writelines(indexFiles)
+ confFile.writelines(index_end)
+
+ # Error Log Settings
+
+
+ error_log = "errorlog $VH_ROOT/logs/$VH_NAME.error_log {" + "\n"
+ useServer = " useServer 0" + "\n"
+ logLevel = " logLevel ERROR" + "\n"
+ rollingSize = " rollingSize 10M" + "\n"
+ error_log_end = "}" + "\n" + "\n"
+
+ confFile.writelines(error_log)
+ confFile.writelines(useServer)
+ confFile.writelines(logLevel)
+ confFile.writelines(rollingSize)
+ confFile.writelines(error_log_end)
+
+ # Access Log Settings
+
+ access_Log = "accesslog $VH_ROOT/logs/$VH_NAME.access_log {" + "\n"
+ useServer = " useServer 0" + "\n"
+ logFormat = ' logFormat "%v %h %l %u %t \"%r\" %>s %b"' + "\n"
+ logHeaders = " logHeaders 5" + "\n"
+ rollingSize = " rollingSize 10M" + "\n"
+ keepDays = " keepDays 10"
+ compressArchive = " compressArchive 1" + "\n"
+ access_Log_end = "}" + "\n" + "\n"
+
+ confFile.writelines(access_Log)
+ confFile.writelines(useServer)
+ confFile.writelines(logFormat)
+ confFile.writelines(logHeaders)
+ confFile.writelines(rollingSize)
+ confFile.writelines(keepDays)
+ confFile.writelines(compressArchive)
+ confFile.writelines(access_Log_end)
+
+ # php settings
+
+ scripthandler = "scripthandler {" + "\n"
+ add = ""
+ php_end = "}" + "\n" + "\n"
+
+ if phpVersion == "PHP 5.3":
+ add = " add lsapi:php53 php" + "\n"
+ elif phpVersion == "PHP 5.4":
+ add = " add lsapi:php54 php" + "\n"
+ elif phpVersion == "PHP 5.5":
+ add = " add lsapi:php55 php" + "\n"
+ elif phpVersion == "PHP 5.6":
+ add = " add lsapi:php56 php" + "\n"
+ elif phpVersion == "PHP 7.0":
+ add = " add lsapi:php70 php" + "\n"
+ elif phpVersion == "PHP 7.1":
+ add = " add lsapi:php71 php" + "\n"
+
+ confFile.writelines(scripthandler)
+ confFile.writelines(add)
+ confFile.writelines(php_end)
+
+ confFile.close()
+
+ except BaseException, msg:
+ logging.CyberCPLogFileWriter.writeToFile(
+ str(msg) + " [IO Error with per host config file [perHostVirtualConf]]")
+ return 0
+ return 1
+
+
+
@staticmethod
def createConfigInMainVirtualHostFile(virtualHostName):
@@ -127,18 +227,70 @@ class virtualHostUtilities:
return 0
return 1
+ @staticmethod
+ def createDirectoryForDomain(masterDomain, domain, phpVersion, path, administratorEmail):
+
+ confPath = virtualHostUtilities.Server_root + "/conf/vhosts/" + domain
+ completePathToConfigFile = confPath + "/vhost.conf"
+
+ try:
+ os.makedirs(path)
+ except OSError, msg:
+ logging.CyberCPLogFileWriter.writeToFile(
+ str(msg) + " [Not able to directories for virtual host [createDirectoryForDomain]]")
+
+ try:
+ os.makedirs(confPath)
+ except OSError, msg:
+ logging.CyberCPLogFileWriter.writeToFile(
+ str(msg) + " [Not able to directories for virtual host [createDirectoryForDomain]]")
+
+ try:
+ file = open(completePathToConfigFile, "w+")
+ except IOError, msg:
+ logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [createDirectoryForDomain]]")
+ return 0
+
+ try:
+ uid = pwd.getpwnam("lsadm").pw_uid
+ gid = grp.getgrnam("lsadm").gr_gid
+ os.chown(confPath, uid, gid)
+ os.chown(completePathToConfigFile, uid, gid)
+
+ uid = pwd.getpwnam("nobody").pw_uid
+ gid = grp.getgrnam("nobody").gr_gid
+
+ os.chown("/home", uid, gid)
+ os.chown(path, uid, gid)
+
+ except BaseException, msg:
+ logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [createDirectoryForDomain]]")
+
+ if virtualHostUtilities.perHostDomainConf(path, masterDomain, domain, completePathToConfigFile,
+ administratorEmail, phpVersion) == 1:
+ return 1
+ else:
+ return 0
@staticmethod
- def perHostVirtualConf(vhFile,administratorEmail, phpVersion):
+ def perHostDomainConf(path, masterDomain, domain, vhFile, administratorEmail, phpVersion):
# General Configurations tab
+ # virtualhost project.cyberpersons.com {
+ # vhRoot / home / project.cyberpersons.com
+ # configFile $SERVER_ROOT / conf / vhosts /$VH_NAME / vhconf.conf
+ # allowSymbolLink 1
+ # enableScript 1
+ # restrained 1
+ # }
+
try:
confFile = open(vhFile, "w+")
- docRoot = "docRoot $VH_ROOT/public_html" + "\n"
+ docRoot = "docRoot " + path + "\n"
vhDomain = "vhDomain $VH_NAME" + "\n"
- adminEmails = "adminEmails "+ administratorEmail + "\n"
+ adminEmails = "adminEmails " + administratorEmail + "\n"
enableGzip = "enableGzip 1" + "\n"
enableIpGeo = "enableIpGeo 1" + "\n" + "\n"
@@ -148,11 +300,10 @@ class virtualHostUtilities:
confFile.writelines(enableGzip)
confFile.writelines(enableIpGeo)
-
# Index file settings
index = "index {" + "\n"
- userServer= " useServer 0" + "\n"
+ userServer = " useServer 0" + "\n"
indexFiles = " indexFiles index.php, index.html" + "\n"
index_end = "}" + "\n" + "\n"
@@ -164,7 +315,7 @@ class virtualHostUtilities:
# Error Log Settings
- error_log = "errorlog $VH_ROOT/logs/$VH_NAME.error_log {" + "\n"
+ error_log = "errorlog $VH_ROOT/logs/" + masterDomain + ".error_log {" + "\n"
useServer = " useServer 0" + "\n"
logLevel = " logLevel ERROR" + "\n"
rollingSize = " rollingSize 10M" + "\n"
@@ -176,18 +327,16 @@ class virtualHostUtilities:
confFile.writelines(rollingSize)
confFile.writelines(error_log_end)
-
-
# Access Log Settings
- access_Log = "accesslog $VH_ROOT/logs/$VH_NAME.access_log {" + "\n"
- useServer=" useServer 0" + "\n"
- logFormat=' logFormat "%v %h %l %u %t \"%r\" %>s %b"' + "\n"
- logHeaders=" logHeaders 5" + "\n"
- rollingSize=" rollingSize 10M" + "\n"
- keepDays=" keepDays 10"
- compressArchive=" compressArchive 1" + "\n"
- access_Log_end= "}" + "\n" + "\n"
+ access_Log = "accesslog $VH_ROOT/logs/" + masterDomain + ".access_log {" + "\n"
+ useServer = " useServer 0" + "\n"
+ logFormat = ' logFormat "%v %h %l %u %t \"%r\" %>s %b"' + "\n"
+ logHeaders = " logHeaders 5" + "\n"
+ rollingSize = " rollingSize 10M" + "\n"
+ keepDays = " keepDays 10"
+ compressArchive = " compressArchive 1" + "\n"
+ access_Log_end = "}" + "\n" + "\n"
confFile.writelines(access_Log)
confFile.writelines(useServer)
@@ -198,17 +347,12 @@ class virtualHostUtilities:
confFile.writelines(compressArchive)
confFile.writelines(access_Log_end)
-
-
-
-
# php settings
scripthandler = "scripthandler {" + "\n"
add = ""
php_end = "}" + "\n" + "\n"
-
if phpVersion == "PHP 5.3":
add = " add lsapi:php53 php" + "\n"
elif phpVersion == "PHP 5.4":
@@ -226,16 +370,74 @@ class virtualHostUtilities:
confFile.writelines(add)
confFile.writelines(php_end)
-
confFile.close()
- except BaseException,msg:
- logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [IO Error with per host config file [perHostVirtualConf]]")
+ except BaseException, msg:
+ logging.CyberCPLogFileWriter.writeToFile(
+ str(msg) + " [IO Error with per host config file [perHostDomainConf]]")
return 0
return 1
+ @staticmethod
+ def createConfigInMainDomainHostFile(domain,masterDomain):
+ # virtualhost project.cyberpersons.com {
+ # vhRoot / home / project.cyberpersons.com
+ # configFile $SERVER_ROOT / conf / vhosts /$VH_NAME / vhconf.conf
+ # allowSymbolLink 1
+ # enableScript 1
+ # restrained 1
+ # }
+ try:
+ data = open("/usr/local/lsws/conf/httpd_config.conf").readlines()
+ writeDataToFile = open("/usr/local/lsws/conf/httpd_config.conf", 'w')
+
+ spaceonback = " "
+ space = " "
+ space2 = " "
+ space3 = " "
+ space4 = " "
+ space5 = " "
+
+ firstLine = "virtualHost " + domain + " {" + "\n"
+ secondLine = spaceonback + "vhRoot" + space + "/home/" + masterDomain + "\n"
+ thirdLine = spaceonback + "configFile" + space2 + "$SERVER_ROOT" + "/conf/" + "vhosts/" + "$VH_NAME" + "/vhost.conf" + "\n"
+ forthLine = spaceonback + "allowSymbolLink" + space3 + "1" + "\n"
+ fifthLine = spaceonback + "enableScript" + space4 + "1" + "\n"
+ sixthLine = spaceonback + "restrained" + space5 + "1" + "\n"
+ seventhLine = "}" + "\n"
+ map = " map " + domain + " " + domain + "\n"
+
+ checker = 1
+ mapchecker = 1
+
+ for items in data:
+ if ((items.find("virtualHost") > -1 or items.find("virtualhost") > -1) and checker == 1):
+ writeDataToFile.writelines(firstLine)
+ writeDataToFile.writelines(secondLine)
+ writeDataToFile.writelines(thirdLine)
+ writeDataToFile.writelines(forthLine)
+ writeDataToFile.writelines(fifthLine)
+ writeDataToFile.writelines(sixthLine)
+ writeDataToFile.writelines(seventhLine)
+ writeDataToFile.writelines("\n")
+ writeDataToFile.writelines(items)
+ checker = 0
+ elif ((items.find("listener Default{") > -1 or items.find("Default {") > -1) and mapchecker == 1):
+ writeDataToFile.writelines(items)
+ writeDataToFile.writelines(map)
+ mapchecker = 0
+
+ else:
+ writeDataToFile.writelines(items)
+
+ writeDataToFile.close()
+ except BaseException, msg:
+ logging.CyberCPLogFileWriter.writeToFile(
+ str(msg) + " [IO Error with main config file [createConfigInMainVirtualHostFile]]")
+ return 0
+ return 1
@staticmethod
def deleteVirtualHostConfigurations(virtualHostName,numberOfSites):
@@ -338,7 +540,6 @@ class virtualHostUtilities:
return 1
-
@staticmethod
def getDiskUsage(path, totalAllowed):
try:
diff --git a/static/backup/backup.js b/static/backup/backup.js
index ab4e2b27a..ae8c7cef4 100644
--- a/static/backup/backup.js
+++ b/static/backup/backup.js
@@ -396,7 +396,6 @@ app.controller('restoreWebsiteControl', function($scope,$http,$timeout) {
};
-
$scope.restoreBackup = function(){
var backupFile = $scope.backupFile;
@@ -1033,102 +1032,97 @@ app.controller('scheduleBackup', function($scope,$http,$timeout) {
//*** Remote Backup site ****//
app.controller('remoteBackupControl', function($scope, $http, $timeout) {
+
$scope.backupButton = true;
-
- $scope.status_success = true;
- $scope.status_danger = true;
- $scope.status_info = true;
-
$scope.backupLoading = true;
$scope.request = true;
$scope.requestData = "";
$scope.submitDisable = false;
$scope.startRestore = true;
+ $scope.accountsInRemoteServerTable = true;
+ $scope.transferBoxBtn = true;
+ $scope.stopTransferbtn = true;
+ $scope.fetchAccountsBtn = false;
+
+
+ // notifications boxes
+ $scope.notificationsBox = true;
+ $scope.errorMessage = true;
+ $scope.couldNotConnect = true;
+ $scope.accountsFetched = true;
+ $scope.backupProcessStarted = true;
+ $scope.backupCancelled = true;
+
+ // status box
+
+ $scope.backupStatus = true;
+
+ var websitesToBeBacked = [];
+ var websitesToBeBackedTemp = [];
+
+ var index = 0;
+ var tempTransferDir = "";
+
$scope.passwordEnter = function() {
$scope.backupButton = false;
};
- var seek = 0;
- var backupDir;
- var username = "admin";
-
-
-
- function getBackupStatus(password) {
-
- url = "/backup/getRemoteTransferStatus";
-
- var data = {
- ipAddress: $scope.IPAddress,
- seek: seek,
- backupDir: backupDir,
- };
-
- var config = {
- headers: {
- 'X-CSRFToken': getCookie('csrftoken')
- }
- };
-
-
- console.log("Initiating Status with seek: " + seek)
-
- $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
-
- function ListInitialDatas(response) {
- console.log(response.data)
-
- if (response.data.remoteTransferStatus == 1) {
- seek = response.data.where;
- if (response.data.complete == 1) {
- $scope.submitDisable = false;
- $scope.backupLoading = true;
-
- $scope.status_danger = true;
- $scope.status_info = true;
- $scope.status_success = false;
- $scope.startRestore = true;
- $scope.statusBox = "Backup Files Transferred! Require Permission to restore backups";
- $scope.requestData = $scope.requestData + response.data.logs
- seek = 0;
-
- $scope.startRestore = false;
- } else {
- $scope.requestData = $scope.requestData + response.data.logs
- $timeout(getBackupStatus(password), 5000);
+ $scope.addRemoveWebsite = function (website,websiteStatus) {
+ if(websiteStatus==true)
+ {
+ var check = 1;
+ for(var j = 0; j < websitesToBeBacked.length; j++){
+ if (websitesToBeBacked[j] == website){
+ check = 0;
+ break;
+ }
}
- } else {
- if (response.data.error_message == "list index out of range") {
- $timeout(getBackupStatus(password), 5000);
- } else {
- $scope.submitDisable = false;
- $scope.status_danger = false;
- $scope.status_info = true;
- $scope.status_success = true;
- $scope.statusBox = "Unable to Transfer File: " + response.data.error_message;
- }
-
+ if(check == 1) {
+ websitesToBeBacked.push(website);
}
}
+ else{
- function cantLoadInitialDatas(response) {
- $scope.status_danger = false;
- $scope.status_info = true;
- $scope.status_success = true;
- $scope.statusBox = "Unable to connect"
+ var tempArray = [];
+
+ for(var j = 0; j < websitesToBeBacked.length; j++){
+ if (websitesToBeBacked[j] != website){
+ tempArray.push(websitesToBeBacked[j]);
+ }
+ }
+ websitesToBeBacked = tempArray;
}
};
- $scope.submitRemoteBackup = function() {
- $scope.requestData = "";
- $scope.status_success = true;
- $scope.status_danger = true;
- $scope.status_info = true;
+ $scope.allChecked = function (webSiteStatus) {
+
+
+
+ if(webSiteStatus==true) {
+
+ websitesToBeBacked = websitesToBeBackedTemp;
+ $scope.webSiteStatus = true;
+ }
+ else{
+ websitesToBeBacked = [];
+ $scope.webSiteStatus = false;
+ }
+ };
+
+ $scope.fetchAccountsFromRemoteServer = function () {
$scope.backupLoading = false;
- $scope.submitDisable = true;
+
+ // notifications boxes
+ $scope.notificationsBox = true;
+ $scope.errorMessage = true;
+ $scope.couldNotConnect = true;
+ $scope.accountsFetched = true;
+ $scope.backupProcessStarted = true;
+ $scope.backupCancelled = true;
+
var IPAddress = $scope.IPAddress;
var password = $scope.password;
@@ -1136,7 +1130,6 @@ app.controller('remoteBackupControl', function($scope, $http, $timeout) {
var data = {
ipAddress: IPAddress,
- username: username,
password: password,
};
@@ -1147,48 +1140,96 @@ app.controller('remoteBackupControl', function($scope, $http, $timeout) {
};
-
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
-
function ListInitialDatas(response) {
- console.log(response.data)
if (response.data.status == 1) {
- $scope.request = false;
- console.log("Backup generated!!")
- backupDir = response.data.dir;
- getBackupStatus(password);
- } else {
- $scope.submitDisable = false;
+ $scope.records = JSON.parse(response.data.data);
+ var parsed = JSON.parse(response.data.data);
+
+ for(var j = 0; j < parsed.length; j++){
+ websitesToBeBackedTemp.push(parsed[j].website);
+ }
+
+ $scope.accountsInRemoteServerTable = false;
$scope.backupLoading = true;
- $scope.status_danger = false;
- $scope.status_info = true;
- $scope.status_success = true;
- $scope.statusBox = "Unable to Transfer File: " + response.data.error_message;
+ // enable the transfer/cancel btn
+
+ $scope.transferBoxBtn = false;
+
+ // notifications boxes
+ $scope.notificationsBox = false;
+ $scope.errorMessage = true;
+ $scope.couldNotConnect = true;
+ $scope.accountsFetched = false;
+ $scope.backupProcessStarted = true;
+ $scope.backupCancelled = true;
+
+
+ }
+ else {
+ $scope.error_message = response.data.error_message;
+ $scope.backupLoading = true;
+
+ // notifications boxes
+ $scope.notificationsBox = false;
+ $scope.errorMessage = false;
+ $scope.couldNotConnect = true;
+ $scope.accountsFetched = true;
+ $scope.backupProcessStarted = true;
+ $scope.backupCancelled = true;
}
}
function cantLoadInitialDatas(response) {
- $scope.status_danger = false;
- $scope.status_info = true;
- $scope.status_success = true;
- $scope.statusBox = "Unable to connect"
+
+ // notifications boxes
+
+ $scope.notificationsBox = false;
+ $scope.errorMessage = true;
+ $scope.couldNotConnect = false;
+ $scope.accountsFetched = true;
+ $scope.backupProcessStarted = true;
+ $scope.backupCancelled = true;
+
}
};
+
+ $scope.startTransfer = function () {
- function getRestStatus() {
+ // notifications boxes
+ $scope.notificationsBox = true;
+ $scope.errorMessage = true;
+ $scope.couldNotConnect = true;
+ $scope.accountsFetched = true;
+ $scope.backupProcessStarted = true;
+ $scope.backupCancelled = true;
- url = "/backup/remoteRestoreStatus";
+
+
+ if(websitesToBeBacked.length === 0){
+ alert("No websites selected for transfer.")
+ return;
+ }
+
+ $scope.fetchAccountsBtn = true;
+
+ $scope.backupLoading = false;
+
+ var IPAddress = $scope.IPAddress;
+ var password = $scope.password;
+
+ url = "/backup/starRemoteTransfer";
var data = {
- seek: seek,
- backupDir: backupDir,
+ ipAddress: IPAddress,
+ password: password,
+ accountsToTransfer:websitesToBeBacked,
};
- console.log(data)
var config = {
headers: {
@@ -1197,69 +1238,142 @@ app.controller('remoteBackupControl', function($scope, $http, $timeout) {
};
- console.log("Initiating Status with seek: " + seek)
-
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
function ListInitialDatas(response) {
- console.log(response.data)
- if (response.data.remoteRestoreStatus == 1) {
- seek = response.data.where;
- console.log(seek);
- if (response.data.complete == 1) {
- $scope.submitDisable = false;
- $scope.backupLoading = true;
+ if (response.data.remoteTransferStatus == 1) {
+ tempTransferDir = response.data.dir;
+ $scope.accountsInRemoteServerTable = true;
- $scope.status_danger = true;
- $scope.status_info = true;
- $scope.status_success = false;
+ // notifications boxes
+ $scope.notificationsBox = false;
+ $scope.errorMessage = true;
+ $scope.couldNotConnect = true;
+ $scope.accountsFetched = true;
+ $scope.backupProcessStarted = false;
+ $scope.backupCancelled = true;
- $scope.statusBox = "Backup Files Restored!";
- $scope.requestData = $scope.requestData + response.data.logs
- $scope.startRestore = false;
- } else {
- $scope.requestData = $scope.requestData + response.data.logs
- $timeout(getRestStatus(), 5000);
- }
- } else {
- if (response.data.error_message == "list index out of range") {
- $timeout(getRestStatus(), 5000);
- } else {
- $scope.submitDisable = false;
- $scope.status_danger = false;
- $scope.status_info = true;
- $scope.status_success = true;
- $scope.statusBox = "Unable to Restore File: " + response.data.error_message;
- }
+ // disable transfer button
+
+ $scope.startTransferbtn = true;
+
+
+ // enable cancel button
+
+ $scope.stopTransferbtn = false;
+
+
+ getBackupStatus();
+
+
+ }
+ else {
+
+ $scope.error_message = response.data.error_message;
+ $scope.backupLoading = true;
+
+ // Notifications box settings
+
+ // notifications boxes
+ $scope.notificationsBox = false;
+ $scope.errorMessage = false;
+ $scope.couldNotConnect = true;
+ $scope.accountsFetched = true;
+ $scope.backupProcessStarted = true;
+ $scope.backupCancelled = true;
}
}
function cantLoadInitialDatas(response) {
- $scope.status_danger = false;
- $scope.status_info = true;
- $scope.status_success = true;
- $scope.statusBox = "Unable to connect"
+
+ // Notifications box settings
+
+ // notifications boxes
+ $scope.notificationsBox = false;
+ $scope.errorMessage = true;
+ $scope.couldNotConnect = false;
+ $scope.accountsFetched = true;
+ $scope.backupProcessStarted = true;
+ $scope.backupCancelled = true;
+
+ }
+
+ };
+
+
+
+ function getBackupStatus(password) {
+
+ url = "/backup/getRemoteTransferStatus";
+
+ var data = {
+ password : $scope.password,
+ ipAddress: $scope.IPAddress,
+ dir: tempTransferDir,
+ };
+
+ var config = {
+ headers: {
+ 'X-CSRFToken': getCookie('csrftoken')
+ }
+ };
+
+
+ $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
+
+ function ListInitialDatas(response) {
+
+ if (response.data.remoteTransferStatus == 1) {
+
+ if(response.data.backupsSent == 0){
+ $scope.backupStatus = false;
+ $scope.requestData = response.data.status;
+ $timeout(getBackupStatus, 2000);
+ }
+ else{
+ $scope.requestData = response.data.status;
+ $timeout.cancel();
+ $scope.backupLoading = true;
+ remoteBackupRestore();
+ }
+ }
+ else{
+
+ $scope.error_message = response.data.error_message;
+ $scope.backupLoading = true;
+ $scope.couldNotConnect = true;
+
+ // Notifications box settings
+
+ $scope.couldNotConnect = true;
+ $scope.errorMessage = false;
+ $scope.accountsFetched = true;
+ $scope.notificationsBox = false;
+ $timeout.cancel();
+
+ }
+
+ }
+
+ function cantLoadInitialDatas(response) {
+ // Notifications box settings
+
+ $scope.couldNotConnect = false;
+ $scope.errorMessage = true;
+ $scope.accountsFetched = true;
+ $scope.notificationsBox = false;
}
};
- $scope.submitBackupRestore = function() {
- $scope.status_success = true;
- $scope.status_danger = true;
- $scope.status_info = false;
- $scope.statusBox = "Restoring Backup";
-
- $scope.backupLoading = false;
- $scope.submitDisable = true;
-
+ function remoteBackupRestore(){
url = "/backup/remoteBackupRestore";
var data = {
- backupDir: backupDir
+ backupDir: tempTransferDir,
};
- console.log(data)
var config = {
headers: {
@@ -1267,42 +1381,241 @@ app.controller('remoteBackupControl', function($scope, $http, $timeout) {
}
};
- seek = 0
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
function ListInitialDatas(response) {
- console.log(response.data)
if (response.data.remoteRestoreStatus == 1) {
- $scope.request = false;
- $scope.backupLoading = false;
+ localRestoreStatus();
+ }
+ }
- $scope.status_danger = true;
- $scope.status_info = true;
- $scope.status_success = false;
- $scope.statusBox = "Restore in Progress, fetching details"
- getRestStatus();
- } else {
- $scope.submitDisable = false;
+ function cantLoadInitialDatas(response) {
+ // Notifications box settings
+
+ $scope.couldNotConnect = false;
+ $scope.errorMessage = true;
+ $scope.accountsFetched = true;
+ $scope.notificationsBox = false;
+ }
+
+ ///////////////
+
+ };
+
+ function localRestoreStatus(password) {
+
+
+
+ url = "/backup/localRestoreStatus";
+
+ var data = {
+ backupDir: tempTransferDir,
+ };
+
+ var config = {
+ headers: {
+ 'X-CSRFToken': getCookie('csrftoken')
+ }
+ };
+
+
+ $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
+
+ function ListInitialDatas(response) {
+
+ if (response.data.remoteTransferStatus == 1) {
+
+ if(response.data.complete == 0){
+ $scope.backupStatus = false;
+ $scope.requestData = response.data.status;
+ $timeout(localRestoreStatus, 2000);
+ }
+ else{
+ $scope.requestData = response.data.status;
+ $timeout.cancel();
+ $scope.backupLoading = true;
+ $scope.startTransferbtn = false;
+ }
+ }
+ else{
+
+ $scope.error_message = response.data.error_message;
$scope.backupLoading = true;
- $scope.status_danger = false;
- $scope.status_info = true;
- $scope.status_success = true;
- $scope.statusBox = "Unable to Restore Backups: " + response.data.error_message;
+ $scope.couldNotConnect = true;
+
+ // Notifications box settings
+
+ $scope.couldNotConnect = true;
+ $scope.errorMessage = false;
+ $scope.accountsFetched = true;
+ $scope.notificationsBox = false;
+
}
}
function cantLoadInitialDatas(response) {
- $scope.status_danger = false;
- $scope.status_info = true;
- $scope.status_success = true;
- $scope.statusBox = "Unable to connect";
+ // Notifications box settings
+
+ $scope.couldNotConnect = false;
+ $scope.errorMessage = true;
+ $scope.accountsFetched = true;
+ $scope.notificationsBox = false;
+ }
+ };
+
+
+ function restoreAccounts() {
+
+ url = "/backup/getRemoteTransferStatus";
+
+ var data = {
+ password : $scope.password,
+ ipAddress: $scope.IPAddress,
+ dir: tempTransferDir,
+ };
+
+ var config = {
+ headers: {
+ 'X-CSRFToken': getCookie('csrftoken')
+ }
+ };
+
+
+ $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
+
+ function ListInitialDatas(response) {
+
+ if (response.data.remoteTransferStatus == 1) {
+
+ if(response.data.backupsSent == 0){
+ $scope.backupStatus = false;
+ $scope.requestData = response.data.status;
+ $timeout(getBackupStatus, 2000);
+ }
+ else{
+ $timeout.cancel();
+ }
+ }
+
+ }
+
+ function cantLoadInitialDatas(response) {
+ // Notifications box settings
+
+ $scope.couldNotConnect = false;
+ $scope.errorMessage = true;
+ $scope.accountsFetched = true;
+ $scope.notificationsBox = false;
+ }
+ };
+
+ $scope.cancelRemoteBackup = function () {
+
+
+ $scope.backupLoading = false;
+
+ // notifications boxes
+ $scope.notificationsBox = true;
+ $scope.errorMessage = true;
+ $scope.couldNotConnect = true;
+ $scope.accountsFetched = true;
+ $scope.backupProcessStarted = true;
+ $scope.backupCancelled = true;
+
+ var IPAddress = $scope.IPAddress;
+ var password = $scope.password;
+
+ url = "/backup/cancelRemoteBackup";
+
+ var data = {
+ ipAddress: IPAddress,
+ password: password,
+ dir:tempTransferDir,
+ };
+
+ var config = {
+ headers: {
+ 'X-CSRFToken': getCookie('csrftoken')
+ }
+ };
+
+
+ $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
+
+ function ListInitialDatas(response) {
+
+ if (response.data.cancelStatus == 1) {
+ $scope.backupLoading = true;
+
+ // notifications boxes
+ $scope.notificationsBox = false;
+ $scope.errorMessage = true;
+ $scope.couldNotConnect = true;
+ $scope.accountsFetched = true;
+ $scope.backupProcessStarted = true;
+ $scope.backupCancelled = false;
+
+ // enable transfer button
+
+ $scope.startTransferbtn = false;
+
+ //disable cancel button
+
+ $scope.stopTransferbtn = true;
+
+ // hide status box
+
+ $scope.backupStatus = true;
+
+ // bring back websites table
+
+ $scope.accountsInRemoteServerTable = false;
+
+ // enable fetch button
+
+ $scope.fetchAccountsBtn = false;
+
+
+ }
+ else {
+
+ $scope.error_message = response.data.error_message;
+ $scope.backupLoading = true;
+
+ // notifications boxes
+
+ $scope.notificationsBox = false;
+ $scope.errorMessage = false;
+ $scope.couldNotConnect = true;
+ $scope.accountsFetched = true;
+ $scope.backupProcessStarted = true;
+ $scope.backupCancelled = true;
+
+
+
+ }
+
+ }
+
+ function cantLoadInitialDatas(response) {
+
+ // notifications boxes
+
+ $scope.notificationsBox = false;
+ $scope.errorMessage = true;
+ $scope.couldNotConnect = false;
+ $scope.accountsFetched = true;
+ $scope.backupProcessStarted = true;
+ $scope.backupCancelled = true;
+
}
};
+
});
///** Backup site ends **///
\ No newline at end of file
diff --git a/static/baseTemplate/custom-js/system-status.js b/static/baseTemplate/custom-js/system-status.js
index 0e1acce2e..899b204ed 100644
--- a/static/baseTemplate/custom-js/system-status.js
+++ b/static/baseTemplate/custom-js/system-status.js
@@ -124,6 +124,11 @@ app.controller('adminController', function($scope,$http,$timeout) {
$("#backupDestinations").hide();
$("#scheduleBackup").hide();
+ $("#remoteBackups").hide();
+ $("#packageHome").hide();
+ $("#packageSub").hide();
+ $("#createWebsite").hide();
+
}
}
diff --git a/static/packages/packages.js b/static/packages/packages.js
index 8145c2236..925f00e40 100644
--- a/static/packages/packages.js
+++ b/static/packages/packages.js
@@ -62,7 +62,8 @@ app.controller('createPackage', function($scope,$http) {
bandwidth: bandwidth,
ftpAccounts: ftpAccounts,
dataBases: dataBases,
- emails:emails
+ emails:emails,
+ allowedDomains:$scope.allowedDomains
};
var config = {
@@ -238,6 +239,7 @@ app.controller('modifyPackages', function($scope,$http) {
$scope.ftpAccounts = response.data.ftpAccounts;
$scope.dataBases = response.data.dataBases;
$scope.emails = response.data.emails;
+ $scope.allowedDomains = response.data.allowedDomains;
$scope.modifyButton = "Save Details"
@@ -285,7 +287,8 @@ app.controller('modifyPackages', function($scope,$http) {
bandwidth:bandwidth,
ftpAccounts:ftpAccounts,
dataBases:dataBases,
- emails:emails
+ emails:emails,
+ allowedDomains:$scope.allowedDomains,
};
var config = {
diff --git a/static/websiteFunctions/websiteFunctions.js b/static/websiteFunctions/websiteFunctions.js
index c3435f118..ed008dcc9 100644
--- a/static/websiteFunctions/websiteFunctions.js
+++ b/static/websiteFunctions/websiteFunctions.js
@@ -1198,11 +1198,438 @@ app.controller('websitePages', function($scope,$http) {
+ }
+
+ };
+
+
+ ////// create domain part
+
+ $("#domainCreationForm").hide();
+
+ $scope.showCreateDomainForm = function () {
+ $("#domainCreationForm").fadeIn();
+ };
+
+ $scope.hideDomainCreationForm = function () {
+ $("#domainCreationForm").fadeOut();
+ };
+
+ $scope.masterDomain = $("#domainNamePage").text();
+
+ // notifcations settings
+ $scope.domainLoading = true;
+ $scope.websiteCreationFailed = true;
+ $scope.domainCreated = true;
+ $scope.couldNotConnect = true;
+
+ $scope.createDomain = function(){
+
+ // notifcations settings
+ $scope.domainLoading = false;
+ $scope.websiteCreationFailed = true;
+ $scope.domainCreated = true;
+ $scope.couldNotConnect = true;
+
+ if ($scope.sslCheck === true){
+ var ssl = 1;
+ }
+ else{
+ var ssl = 0
+ }
+
+
+ url = "/websites/submitDomainCreation";
+ var domainName = $scope.domainNameCreate;
+ var phpSelection = $scope.phpSelection;
+
+ var path = $scope.docRootPath;
+
+ if (typeof path === 'undefined'){
+ path = "";
+ }
+
+
+ var data = {
+ domainName: domainName,
+ phpSelection: phpSelection,
+ ssl:ssl,
+ path:path,
+ masterDomain:$("#domainNamePage").text(),
+ };
+
+ var config = {
+ headers : {
+ 'X-CSRFToken': getCookie('csrftoken')
+ }
+ };
+
+ $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
+
+
+ function ListInitialDatas(response) {
+
+
+ if(response.data.createWebSiteStatus === 1){
+
+ $scope.websiteDomain = domainName;
+
+ // notifcations settings
+ $scope.domainLoading = true;
+ $scope.websiteCreationFailed = true;
+ $scope.domainCreated = false;
+ $scope.couldNotConnect = true
+
+
+ }
+ else{
+
+ $scope.errorMessage = response.data.error_message;
+
+ // notifcations settings
+ $scope.domainLoading = true;
+ $scope.websiteCreationFailed = false;
+ $scope.domainCreated = true;
+ $scope.couldNotConnect = true;
+
+ }
+
+
+ }
+ function cantLoadInitialDatas(response) {
+
+ // notifcations settings
+ $scope.domainLoading = true;
+ $scope.websiteCreationFailed = true;
+ $scope.domainCreated = true;
+ $scope.couldNotConnect = false;
+
+ }
+
+
+
+
+
+ };
+
+
+ ////// List Domains Part
+
+ ////////////////////////
+
+ // notifcations
+
+ $scope.phpChanged = true;
+ $scope.domainError = true;
+ $scope.couldNotConnect = true;
+ $scope.domainDeleted = true;
+ $scope.sslIssued = true;
+
+ $("#listDomains").hide();
+
+
+ $scope.showListDomains = function () {
+ fetchDomains();
+ $("#listDomains").fadeIn();
+ };
+
+ $scope.hideListDomains = function () {
+ $("#listDomains").fadeOut();
+ };
+
+ function fetchDomains(){
+ $scope.domainLoading = false;
+
+ var url = "/websites/fetchDomains";
+
+ var data = {
+ masterDomain:$("#domainNamePage").text(),
+ };
+
+ var config = {
+ headers : {
+ 'X-CSRFToken': getCookie('csrftoken')
+ }
+ };
+
+ $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
+
+
+ function ListInitialDatas(response) {
+
+
+ if(response.data.fetchStatus === 1){
+
+ $scope.childDomains = JSON.parse(response.data.data);
+ $scope.domainLoading = true;
+
+
+ }
+ else{
+ $scope.domainError = false;
+ $scope.errorMessage = response.data.error_message;
+ $scope.domainLoading = true;
+ }
+
+
+ }
+ function cantLoadInitialDatas(response) {
+
+ $scope.couldNotConnect = false;
+
}
}
+ $scope.changePHP = function(childDomain,phpSelection){
+
+ // notifcations
+
+ $scope.phpChanged = true;
+ $scope.domainError = true;
+ $scope.couldNotConnect = true;
+ $scope.domainDeleted = true;
+ $scope.sslIssued = true;
+ $scope.domainLoading = false;
+
+ var url = "/websites/changePHP";
+
+ var data = {
+ childDomain:childDomain,
+ phpSelection:phpSelection,
+ };
+
+ var config = {
+ headers : {
+ 'X-CSRFToken': getCookie('csrftoken')
+ }
+ };
+
+ $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
+
+
+ function ListInitialDatas(response) {
+
+
+ if(response.data.changePHP === 1){
+
+ $scope.domainLoading = true;
+
+ $scope.changedPHPVersion = phpSelection;
+
+
+ // notifcations
+
+ $scope.phpChanged = false;
+ $scope.domainError = true;
+ $scope.couldNotConnect = true;
+ $scope.domainDeleted = true;
+ $scope.sslIssued = true;
+
+
+ }
+ else{
+ $scope.errorMessage = response.data.error_message;
+ $scope.domainLoading = true;
+
+ // notifcations
+
+ $scope.phpChanged = true;
+ $scope.domainError = false;
+ $scope.couldNotConnect = true;
+ $scope.domainDeleted = true;
+ $scope.sslIssued = true;
+ }
+
+
+ }
+ function cantLoadInitialDatas(response) {
+
+ $scope.domainLoading = true;
+
+ // notifcations
+
+ $scope.phpChanged = true;
+ $scope.domainError = false;
+ $scope.couldNotConnect = true;
+ $scope.domainDeleted = true;
+ $scope.sslIssued = true;
+
+ }
+
+ }
+
+ $scope.deleteChildDomain = function(childDomain){
+ $scope.domainLoading = false;
+
+ // notifcations
+
+ $scope.phpChanged = true;
+ $scope.domainError = true;
+ $scope.couldNotConnect = true;
+ $scope.domainDeleted = true;
+ $scope.sslIssued = true;
+
+ url = "/websites/submitDomainDeletion";
+
+ var data = {
+ websiteName: childDomain,
+ };
+
+ var config = {
+ headers : {
+ 'X-CSRFToken': getCookie('csrftoken')
+ }
+ };
+
+ $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
+
+
+ function ListInitialDatas(response) {
+
+
+ if(response.data.websiteDeleteStatus === 1){
+
+ $scope.domainLoading = true;
+ $scope.deletedDomain = childDomain;
+
+ fetchDomains();
+
+
+ // notifications
+
+ $scope.phpChanged = true;
+ $scope.domainError = true;
+ $scope.couldNotConnect = true;
+ $scope.domainDeleted = false;
+ $scope.sslIssued = true;
+
+
+
+ }
+ else{
+ $scope.errorMessage = response.data.error_message;
+ $scope.domainLoading = true;
+
+ // notifcations
+
+ $scope.phpChanged = true;
+ $scope.domainError = false;
+ $scope.couldNotConnect = true;
+ $scope.domainDeleted = true;
+ $scope.sslIssued = true;
+ }
+
+
+ }
+ function cantLoadInitialDatas(response) {
+
+ $scope.domainLoading = true;
+
+ // notifcations
+
+ $scope.phpChanged = true;
+ $scope.domainError = true;
+ $scope.couldNotConnect = false;
+ $scope.domainDeleted = true;
+ $scope.sslIssued = true;
+
+ }
+
+ }
+
+ $scope.issueSSL = function(childDomain,path){
+ $scope.domainLoading = false;
+
+ // notifcations
+
+ $scope.phpChanged = true;
+ $scope.domainError = true;
+ $scope.couldNotConnect = true;
+ $scope.domainDeleted = true;
+ $scope.sslIssued = true;
+
+ var url = "/manageSSL/issueSSL";
+
+
+ var data = {
+ virtualHost:childDomain,
+ path:path,
+ };
+
+ var config = {
+ headers : {
+ 'X-CSRFToken': getCookie('csrftoken')
+ }
+ };
+
+ $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
+
+
+ function ListInitialDatas(response) {
+
+
+ if(response.data.SSL == 1){
+
+ $scope.domainLoading = true;
+
+ // notifcations
+
+ $scope.phpChanged = true;
+ $scope.domainError = true;
+ $scope.couldNotConnect = true;
+ $scope.domainDeleted = true;
+ $scope.sslIssued = false;
+
+
+
+ $scope.sslDomainIssued = childDomain;
+
+
+ }
+
+ else
+ {
+ $scope.domainLoading = true;
+
+ $scope.errorMessage = response.data.error_message;
+
+ // notifcations
+
+ $scope.phpChanged = true;
+ $scope.domainError = false;
+ $scope.couldNotConnect = true;
+ $scope.domainDeleted = true;
+ $scope.sslIssued = true;
+
+ }
+
+
+
+ }
+ function cantLoadInitialDatas(response) {
+
+ // notifcations
+
+ $scope.phpChanged = true;
+ $scope.domainError = true;
+ $scope.couldNotConnect = false;
+ $scope.domainDeleted = true;
+ $scope.sslIssued = true;
+
+
+ }
+
+
+
+
+
+ };
+
+
+
+
});
/* Java script code to create account ends here */
diff --git a/websiteFunctions/models.py b/websiteFunctions/models.py
index d7ed60c51..f267d1cf1 100644
--- a/websiteFunctions/models.py
+++ b/websiteFunctions/models.py
@@ -17,6 +17,14 @@ class Websites(models.Model):
ssl = models.IntegerField()
state = models.IntegerField(default=1)
+class ChildDomains(models.Model):
+ master = models.ForeignKey(Websites,on_delete=models.CASCADE)
+ domain = models.CharField(max_length=50, unique=True)
+ path = models.CharField(max_length=200,default=None)
+ ssl = models.IntegerField()
+ phpSelection = models.CharField(max_length=10,default=None)
+
+
class Backups(models.Model):
website = models.ForeignKey(Websites,on_delete=models.CASCADE)
fileName = models.CharField(max_length=50)
diff --git a/websiteFunctions/models.pyc b/websiteFunctions/models.pyc
index 9d4a0c592..04409ac6d 100644
Binary files a/websiteFunctions/models.pyc and b/websiteFunctions/models.pyc differ
diff --git a/websiteFunctions/static/websiteFunctions/websiteFunctions.js b/websiteFunctions/static/websiteFunctions/websiteFunctions.js
index c3435f118..ed008dcc9 100644
--- a/websiteFunctions/static/websiteFunctions/websiteFunctions.js
+++ b/websiteFunctions/static/websiteFunctions/websiteFunctions.js
@@ -1198,11 +1198,438 @@ app.controller('websitePages', function($scope,$http) {
+ }
+
+ };
+
+
+ ////// create domain part
+
+ $("#domainCreationForm").hide();
+
+ $scope.showCreateDomainForm = function () {
+ $("#domainCreationForm").fadeIn();
+ };
+
+ $scope.hideDomainCreationForm = function () {
+ $("#domainCreationForm").fadeOut();
+ };
+
+ $scope.masterDomain = $("#domainNamePage").text();
+
+ // notifcations settings
+ $scope.domainLoading = true;
+ $scope.websiteCreationFailed = true;
+ $scope.domainCreated = true;
+ $scope.couldNotConnect = true;
+
+ $scope.createDomain = function(){
+
+ // notifcations settings
+ $scope.domainLoading = false;
+ $scope.websiteCreationFailed = true;
+ $scope.domainCreated = true;
+ $scope.couldNotConnect = true;
+
+ if ($scope.sslCheck === true){
+ var ssl = 1;
+ }
+ else{
+ var ssl = 0
+ }
+
+
+ url = "/websites/submitDomainCreation";
+ var domainName = $scope.domainNameCreate;
+ var phpSelection = $scope.phpSelection;
+
+ var path = $scope.docRootPath;
+
+ if (typeof path === 'undefined'){
+ path = "";
+ }
+
+
+ var data = {
+ domainName: domainName,
+ phpSelection: phpSelection,
+ ssl:ssl,
+ path:path,
+ masterDomain:$("#domainNamePage").text(),
+ };
+
+ var config = {
+ headers : {
+ 'X-CSRFToken': getCookie('csrftoken')
+ }
+ };
+
+ $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
+
+
+ function ListInitialDatas(response) {
+
+
+ if(response.data.createWebSiteStatus === 1){
+
+ $scope.websiteDomain = domainName;
+
+ // notifcations settings
+ $scope.domainLoading = true;
+ $scope.websiteCreationFailed = true;
+ $scope.domainCreated = false;
+ $scope.couldNotConnect = true
+
+
+ }
+ else{
+
+ $scope.errorMessage = response.data.error_message;
+
+ // notifcations settings
+ $scope.domainLoading = true;
+ $scope.websiteCreationFailed = false;
+ $scope.domainCreated = true;
+ $scope.couldNotConnect = true;
+
+ }
+
+
+ }
+ function cantLoadInitialDatas(response) {
+
+ // notifcations settings
+ $scope.domainLoading = true;
+ $scope.websiteCreationFailed = true;
+ $scope.domainCreated = true;
+ $scope.couldNotConnect = false;
+
+ }
+
+
+
+
+
+ };
+
+
+ ////// List Domains Part
+
+ ////////////////////////
+
+ // notifcations
+
+ $scope.phpChanged = true;
+ $scope.domainError = true;
+ $scope.couldNotConnect = true;
+ $scope.domainDeleted = true;
+ $scope.sslIssued = true;
+
+ $("#listDomains").hide();
+
+
+ $scope.showListDomains = function () {
+ fetchDomains();
+ $("#listDomains").fadeIn();
+ };
+
+ $scope.hideListDomains = function () {
+ $("#listDomains").fadeOut();
+ };
+
+ function fetchDomains(){
+ $scope.domainLoading = false;
+
+ var url = "/websites/fetchDomains";
+
+ var data = {
+ masterDomain:$("#domainNamePage").text(),
+ };
+
+ var config = {
+ headers : {
+ 'X-CSRFToken': getCookie('csrftoken')
+ }
+ };
+
+ $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
+
+
+ function ListInitialDatas(response) {
+
+
+ if(response.data.fetchStatus === 1){
+
+ $scope.childDomains = JSON.parse(response.data.data);
+ $scope.domainLoading = true;
+
+
+ }
+ else{
+ $scope.domainError = false;
+ $scope.errorMessage = response.data.error_message;
+ $scope.domainLoading = true;
+ }
+
+
+ }
+ function cantLoadInitialDatas(response) {
+
+ $scope.couldNotConnect = false;
+
}
}
+ $scope.changePHP = function(childDomain,phpSelection){
+
+ // notifcations
+
+ $scope.phpChanged = true;
+ $scope.domainError = true;
+ $scope.couldNotConnect = true;
+ $scope.domainDeleted = true;
+ $scope.sslIssued = true;
+ $scope.domainLoading = false;
+
+ var url = "/websites/changePHP";
+
+ var data = {
+ childDomain:childDomain,
+ phpSelection:phpSelection,
+ };
+
+ var config = {
+ headers : {
+ 'X-CSRFToken': getCookie('csrftoken')
+ }
+ };
+
+ $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
+
+
+ function ListInitialDatas(response) {
+
+
+ if(response.data.changePHP === 1){
+
+ $scope.domainLoading = true;
+
+ $scope.changedPHPVersion = phpSelection;
+
+
+ // notifcations
+
+ $scope.phpChanged = false;
+ $scope.domainError = true;
+ $scope.couldNotConnect = true;
+ $scope.domainDeleted = true;
+ $scope.sslIssued = true;
+
+
+ }
+ else{
+ $scope.errorMessage = response.data.error_message;
+ $scope.domainLoading = true;
+
+ // notifcations
+
+ $scope.phpChanged = true;
+ $scope.domainError = false;
+ $scope.couldNotConnect = true;
+ $scope.domainDeleted = true;
+ $scope.sslIssued = true;
+ }
+
+
+ }
+ function cantLoadInitialDatas(response) {
+
+ $scope.domainLoading = true;
+
+ // notifcations
+
+ $scope.phpChanged = true;
+ $scope.domainError = false;
+ $scope.couldNotConnect = true;
+ $scope.domainDeleted = true;
+ $scope.sslIssued = true;
+
+ }
+
+ }
+
+ $scope.deleteChildDomain = function(childDomain){
+ $scope.domainLoading = false;
+
+ // notifcations
+
+ $scope.phpChanged = true;
+ $scope.domainError = true;
+ $scope.couldNotConnect = true;
+ $scope.domainDeleted = true;
+ $scope.sslIssued = true;
+
+ url = "/websites/submitDomainDeletion";
+
+ var data = {
+ websiteName: childDomain,
+ };
+
+ var config = {
+ headers : {
+ 'X-CSRFToken': getCookie('csrftoken')
+ }
+ };
+
+ $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
+
+
+ function ListInitialDatas(response) {
+
+
+ if(response.data.websiteDeleteStatus === 1){
+
+ $scope.domainLoading = true;
+ $scope.deletedDomain = childDomain;
+
+ fetchDomains();
+
+
+ // notifications
+
+ $scope.phpChanged = true;
+ $scope.domainError = true;
+ $scope.couldNotConnect = true;
+ $scope.domainDeleted = false;
+ $scope.sslIssued = true;
+
+
+
+ }
+ else{
+ $scope.errorMessage = response.data.error_message;
+ $scope.domainLoading = true;
+
+ // notifcations
+
+ $scope.phpChanged = true;
+ $scope.domainError = false;
+ $scope.couldNotConnect = true;
+ $scope.domainDeleted = true;
+ $scope.sslIssued = true;
+ }
+
+
+ }
+ function cantLoadInitialDatas(response) {
+
+ $scope.domainLoading = true;
+
+ // notifcations
+
+ $scope.phpChanged = true;
+ $scope.domainError = true;
+ $scope.couldNotConnect = false;
+ $scope.domainDeleted = true;
+ $scope.sslIssued = true;
+
+ }
+
+ }
+
+ $scope.issueSSL = function(childDomain,path){
+ $scope.domainLoading = false;
+
+ // notifcations
+
+ $scope.phpChanged = true;
+ $scope.domainError = true;
+ $scope.couldNotConnect = true;
+ $scope.domainDeleted = true;
+ $scope.sslIssued = true;
+
+ var url = "/manageSSL/issueSSL";
+
+
+ var data = {
+ virtualHost:childDomain,
+ path:path,
+ };
+
+ var config = {
+ headers : {
+ 'X-CSRFToken': getCookie('csrftoken')
+ }
+ };
+
+ $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
+
+
+ function ListInitialDatas(response) {
+
+
+ if(response.data.SSL == 1){
+
+ $scope.domainLoading = true;
+
+ // notifcations
+
+ $scope.phpChanged = true;
+ $scope.domainError = true;
+ $scope.couldNotConnect = true;
+ $scope.domainDeleted = true;
+ $scope.sslIssued = false;
+
+
+
+ $scope.sslDomainIssued = childDomain;
+
+
+ }
+
+ else
+ {
+ $scope.domainLoading = true;
+
+ $scope.errorMessage = response.data.error_message;
+
+ // notifcations
+
+ $scope.phpChanged = true;
+ $scope.domainError = false;
+ $scope.couldNotConnect = true;
+ $scope.domainDeleted = true;
+ $scope.sslIssued = true;
+
+ }
+
+
+
+ }
+ function cantLoadInitialDatas(response) {
+
+ // notifcations
+
+ $scope.phpChanged = true;
+ $scope.domainError = true;
+ $scope.couldNotConnect = false;
+ $scope.domainDeleted = true;
+ $scope.sslIssued = true;
+
+
+ }
+
+
+
+
+
+ };
+
+
+
+
});
/* Java script code to create account ends here */
diff --git a/websiteFunctions/templates/websiteFunctions/createWebsite.html b/websiteFunctions/templates/websiteFunctions/createWebsite.html
index eb10551af..17840ee72 100644
--- a/websiteFunctions/templates/websiteFunctions/createWebsite.html
+++ b/websiteFunctions/templates/websiteFunctions/createWebsite.html
@@ -22,7 +22,7 @@
diff --git a/websiteFunctions/templates/websiteFunctions/website.html b/websiteFunctions/templates/websiteFunctions/website.html
index 48719eaf8..360518eac 100644
--- a/websiteFunctions/templates/websiteFunctions/website.html
+++ b/websiteFunctions/templates/websiteFunctions/website.html
@@ -211,12 +211,236 @@