Skip to content

Commit

Permalink
bug fix: allow numbers in domain
Browse files Browse the repository at this point in the history
  • Loading branch information
usmannasir committed Feb 27, 2020
1 parent fdc2134 commit 5d34aad
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion plogical/backupSchedule.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ def prepare():
pass

for virtualHost in os.listdir("/home"):
if match(r'^[a-zA-Z0-9-]*[a-zA-Z0-9-]{0,61}[a-zA-Z0-9-](?:\.[a-zA-Z-]{2,})+$', virtualHost, M | I):
if match(r'^[a-zA-Z0-9-]*[a-zA-Z0-9-]{0,61}[a-zA-Z0-9-](?:\.[a-zA-Z0-9-]{2,})+$', virtualHost, M | I):
backupSchedule.createBackup(virtualHost, ipAddress, backupLogPath, port)


Expand Down
2 changes: 1 addition & 1 deletion plogical/backupScheduleLocal.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def prepare():
backupSchedule.remoteBackupLogging(backupLogPath, "")

for virtualHost in os.listdir("/home"):
if match(r'^[a-zA-Z0-9-]*[a-zA-Z0-9-]{0,61}[a-zA-Z0-9-](?:\.[a-zA-Z-]{2,})+$', virtualHost, M | I):
if match(r'^[a-zA-Z0-9-]*[a-zA-Z0-9-]{0,61}[a-zA-Z0-9-](?:\.[a-zA-Z0-9-]{2,})+$', virtualHost, M | I):
try:
retValues = backupSchedule.createLocalBackup(virtualHost, backupLogPath)

Expand Down
6 changes: 3 additions & 3 deletions plogical/website.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def submitWebsiteCreation(self, userID=None, data=None):
packageName = data['package']
websiteOwner = data['websiteOwner']

if not match(r'^[a-zA-Z0-9-]*[a-zA-Z0-9-]{0,61}[a-zA-Z0-9-](?:\.[a-zA-Z-]{2,})+$', domain,
if not match(r'^[a-zA-Z0-9-]*[a-zA-Z0-9-]{0,61}[a-zA-Z0-9-](?:\.[a-zA-Z0-9-]{2,})+$', domain,
M | I):
data_ret = {'status': 0, 'createWebSiteStatus': 0, 'error_message': "Invalid domain."}
json_data = json.dumps(data_ret)
Expand Down Expand Up @@ -229,7 +229,7 @@ def submitDomainCreation(self, userID=None, data=None):
path = data['path']
tempStatusPath = "/home/cyberpanel/" + str(randint(1000, 9999))

if not match(r'^[a-zA-Z0-9-]*[a-zA-Z0-9-]{0,61}[a-zA-Z0-9-](?:\.[a-zA-Z-]{2,})+$', domain,
if not match(r'^[a-zA-Z0-9-]*[a-zA-Z0-9-]{0,61}[a-zA-Z0-9-](?:\.[a-zA-Z0-9-]{2,})+$', domain,
M | I):
data_ret = {'status': 0, 'createWebSiteStatus': 0, 'error_message': "Invalid domain."}
json_data = json.dumps(data_ret)
Expand Down Expand Up @@ -1349,7 +1349,7 @@ def submitAliasCreation(self, userID=None, data=None):
aliasDomain = data['aliasDomain']
ssl = data['ssl']

if not match(r'^[a-zA-Z0-9-]*[a-zA-Z0-9-]{0,61}[a-zA-Z0-9-](?:\.[a-zA-Z-]{2,})+$', aliasDomain,
if not match(r'^[a-zA-Z0-9-]*[a-zA-Z0-9-]{0,61}[a-zA-Z0-9-](?:\.[a-zA-Z0-9-]{2,})+$', aliasDomain,
M | I):
data_ret = {'status': 0, 'createAliasStatus': 0, 'error_message': "Invalid domain."}
json_data = json.dumps(data_ret)
Expand Down
12 changes: 6 additions & 6 deletions websiteFunctions/website.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ def submitWebsiteCreation(self, userID=None, data=None):
return ACLManager.loadErrorJson('createWebSiteStatus', 0)


if not match(r'^[a-zA-Z0-9-]*[a-zA-Z0-9-]{0,61}[a-zA-Z0-9-](?:\.[a-zA-Z-]{2,})+$', domain,
if not match(r'^[a-zA-Z0-9-]*[a-zA-Z0-9-]{0,61}[a-zA-Z0-9-](?:\.[a-zA-Z0-9-]{2,})+$', domain,
M | I):
data_ret = {'status': 0, 'createWebSiteStatus': 0, 'error_message': "Invalid domain."}
json_data = json.dumps(data_ret)
Expand Down Expand Up @@ -260,7 +260,7 @@ def submitDomainCreation(self, userID=None, data=None):
path = data['path']
tempStatusPath = "/home/cyberpanel/" + str(randint(1000, 9999))

if not match(r'^[a-zA-Z0-9-]*[a-zA-Z0-9-]{0,61}[a-zA-Z0-9-](?:\.[a-zA-Z-]{2,})+$', domain,
if not match(r'^[a-zA-Z0-9-]*[a-zA-Z0-9-]{0,61}[a-zA-Z0-9-](?:\.[a-zA-Z0-9-]{2,})+$', domain,
M | I):
data_ret = {'status': 0, 'createWebSiteStatus': 0, 'error_message': "Invalid domain."}
json_data = json.dumps(data_ret)
Expand Down Expand Up @@ -1607,7 +1607,7 @@ def submitAliasCreation(self, userID=None, data=None):
aliasDomain = data['aliasDomain']
ssl = data['ssl']

if not match(r'^[a-zA-Z0-9-]*[a-zA-Z0-9-]{0,61}[a-zA-Z0-9-](?:\.[a-zA-Z-]{2,})+$', aliasDomain,
if not match(r'^[a-zA-Z0-9-]*[a-zA-Z0-9-]{0,61}[a-zA-Z0-9-](?:\.[a-zA-Z0-9-]{2,})+$', aliasDomain,
M | I):
data_ret = {'status': 0, 'createAliasStatus': 0, 'error_message': "Invalid domain."}
json_data = json.dumps(data_ret)
Expand Down Expand Up @@ -2697,13 +2697,13 @@ def startCloning(self, userID=None, data=None):

self.domain = data['masterDomain']

if not match(r'^[a-zA-Z0-9-]*[a-zA-Z0-9-]{0,61}[a-zA-Z0-9-](?:\.[a-zA-Z-]{2,})+$', self.domain,
if not match(r'^[a-zA-Z0-9-]*[a-zA-Z0-9-]{0,61}[a-zA-Z0-9-](?:\.[a-zA-Z0-9-]{2,})+$', self.domain,
M | I):
data_ret = {'status': 0, 'createWebSiteStatus': 0, 'error_message': "Invalid domain."}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)

if not match(r'^[a-zA-Z0-9-]*[a-zA-Z0-9-]{0,61}[a-zA-Z0-9-](?:\.[a-zA-Z-]{2,})+$', data['domainName'],
if not match(r'^[a-zA-Z0-9-]*[a-zA-Z0-9-]{0,61}[a-zA-Z0-9-](?:\.[a-zA-Z0-9-]{2,})+$', data['domainName'],
M | I):
data_ret = {'status': 0, 'createWebSiteStatus': 0, 'error_message': "Invalid domain."}
json_data = json.dumps(data_ret)
Expand Down Expand Up @@ -2770,7 +2770,7 @@ def startSync(self, userID=None, data=None):
currentACL = ACLManager.loadedACL(userID)
admin = Administrator.objects.get(pk=userID)

if not match(r'^[a-zA-Z0-9-]*[a-zA-Z0-9-]{0,61}[a-zA-Z0-9-](?:\.[a-zA-Z-]{2,})+$', data['childDomain'],
if not match(r'^[a-zA-Z0-9-]*[a-zA-Z0-9-]{0,61}[a-zA-Z0-9-](?:\.[a-zA-Z0-9-]{2,})+$', data['childDomain'],
M | I):
data_ret = {'status': 0, 'createWebSiteStatus': 0, 'error_message': "Invalid domain."}
json_data = json.dumps(data_ret)
Expand Down

0 comments on commit 5d34aad

Please sign in to comment.