Skip to content
Permalink
Browse files
bug fix: check for website existance without www.
  • Loading branch information
usmannasir committed Nov 11, 2019
1 parent dacf1f5 commit 8138d0f4debe516f82dac6d9721494708b67ab8d
Showing with 21 additions and 0 deletions.
  1. +21 −0 plogical/virtualHostUtilities.py
@@ -105,11 +105,21 @@ def createVirtualHost(virtualHostName, administratorEmail, phpVersion, virtualHo
logging.CyberCPLogFileWriter.statusWriter(tempStatusPath, 'This website already exists. [404]')
return 0, "This website already exists."


if Websites.objects.filter(domain=virtualHostName.lstrip('www.')).count() > 0:
logging.CyberCPLogFileWriter.statusWriter(tempStatusPath, 'This website already exists. [404]')
return 0, "This website already exists."

if ChildDomains.objects.filter(domain=virtualHostName).count() > 0:
logging.CyberCPLogFileWriter.statusWriter(tempStatusPath,
'This website already exists as child domain. [404]')
return 0, "This website already exists as child domain."

if ChildDomains.objects.filter(domain=virtualHostName.lstrip('www.')).count() > 0:
logging.CyberCPLogFileWriter.statusWriter(tempStatusPath,
'This website already exists as child domain. [404]')
return 0, "This website already exists as child domain."

####### Limitations Check End

logging.CyberCPLogFileWriter.statusWriter(tempStatusPath, 'Creating DNS records..,10')
@@ -1040,11 +1050,22 @@ def createDomain(masterDomain, virtualHostName, phpVersion, path, ssl, dkimCheck
'This Domain already exists as a website. [404]')
return 0, "This Domain already exists as a website."

if Websites.objects.filter(domain=virtualHostName.lstrip('www.')).count() > 0:
logging.CyberCPLogFileWriter.statusWriter(tempStatusPath,
'This Domain already exists as a website. [404]')
return 0, "This Domain already exists as a website."

if ChildDomains.objects.filter(domain=virtualHostName).count() > 0:
logging.CyberCPLogFileWriter.statusWriter(tempStatusPath,
'This domain already exists as child domain. [404]')
return 0, "This domain already exists as child domain."


if ChildDomains.objects.filter(domain=virtualHostName.lstrip('www.')).count() > 0:
logging.CyberCPLogFileWriter.statusWriter(tempStatusPath,
'This domain already exists as child domain. [404]')
return 0, "This domain already exists as child domain."

####### Limitations check

master = Websites.objects.get(domain=masterDomain)

1 comment on commit 8138d0f

@w3servicesdotnet
Copy link

@w3servicesdotnet w3servicesdotnet commented on 8138d0f Nov 12, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you !!

Please sign in to comment.