mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-08 22:36:12 +01:00
make sure TTL is 0-86400 inclusive when add or update
This commit is contained in:
@@ -257,6 +257,10 @@ class DNSManager:
|
|||||||
recordType = data['recordType']
|
recordType = data['recordType']
|
||||||
recordName = data['recordName']
|
recordName = data['recordName']
|
||||||
ttl = int(data['ttl'])
|
ttl = int(data['ttl'])
|
||||||
|
if ttl < 0:
|
||||||
|
raise ValueError("TTL: The item must be greater than 0")
|
||||||
|
elif ttl > 86400:
|
||||||
|
raise ValueError("TTL: The item must be lesser than 86401")
|
||||||
|
|
||||||
admin = Administrator.objects.get(pk=userID)
|
admin = Administrator.objects.get(pk=userID)
|
||||||
if ACLManager.checkOwnershipZone(zoneDomain, admin, currentACL) == 1:
|
if ACLManager.checkOwnershipZone(zoneDomain, admin, currentACL) == 1:
|
||||||
@@ -444,6 +448,10 @@ class DNSManager:
|
|||||||
|
|
||||||
if data['ttlNow'] != None:
|
if data['ttlNow'] != None:
|
||||||
record.ttl = int(data['ttlNow'])
|
record.ttl = int(data['ttlNow'])
|
||||||
|
if record.ttl < 0:
|
||||||
|
raise ValueError("TTL: The item must be greater than 0")
|
||||||
|
elif record.ttl > 86400:
|
||||||
|
raise ValueError("TTL: The item must be lesser than 86401")
|
||||||
|
|
||||||
if data['priorityNow'] != None:
|
if data['priorityNow'] != None:
|
||||||
record.prio = int(data['priorityNow'])
|
record.prio = int(data['priorityNow'])
|
||||||
@@ -826,6 +834,10 @@ class DNSManager:
|
|||||||
recordType = data['recordType']
|
recordType = data['recordType']
|
||||||
recordName = data['recordName']
|
recordName = data['recordName']
|
||||||
ttl = int(data['ttl'])
|
ttl = int(data['ttl'])
|
||||||
|
if ttl < 0:
|
||||||
|
raise ValueError("TTL: The item must be greater than 0")
|
||||||
|
elif ttl > 86400:
|
||||||
|
raise ValueError("TTL: The item must be lesser than 86401")
|
||||||
|
|
||||||
admin = Administrator.objects.get(pk=userID)
|
admin = Administrator.objects.get(pk=userID)
|
||||||
self.admin = admin
|
self.admin = admin
|
||||||
|
|||||||
Reference in New Issue
Block a user