diff --git a/dns/dnsManager.py b/dns/dnsManager.py index 7142455b6..8746c212f 100755 --- a/dns/dnsManager.py +++ b/dns/dnsManager.py @@ -257,6 +257,10 @@ def addDNSRecord(self, userID = None, data = None): recordType = data['recordType'] recordName = data['recordName'] 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) if ACLManager.checkOwnershipZone(zoneDomain, admin, currentACL) == 1: @@ -444,6 +448,10 @@ def updateRecord(self, userID = None, data = None): if data['ttlNow'] != None: 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: record.prio = int(data['priorityNow']) @@ -826,6 +834,10 @@ def addDNSRecordCloudFlare(self, userID = None, data = None): recordType = data['recordType'] recordName = data['recordName'] 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) self.admin = admin diff --git a/dns/templates/dns/addDeleteDNSRecords.html b/dns/templates/dns/addDeleteDNSRecords.html index ddf235262..6fde8f740 100755 --- a/dns/templates/dns/addDeleteDNSRecords.html +++ b/dns/templates/dns/addDeleteDNSRecords.html @@ -88,7 +88,7 @@

{% trans "PowerDNS is disabled." %}
-
@@ -114,7 +114,7 @@

{% trans "PowerDNS is disabled." %}
-
@@ -141,7 +141,7 @@

{% trans "PowerDNS is disabled." %}
-
@@ -167,7 +167,7 @@

{% trans "PowerDNS is disabled." %}
-
@@ -199,7 +199,7 @@

{% trans "PowerDNS is disabled." %}
-
@@ -226,7 +226,7 @@

{% trans "PowerDNS is disabled." %}
-
@@ -253,7 +253,7 @@

{% trans "PowerDNS is disabled." %}
-
@@ -280,7 +280,7 @@

{% trans "PowerDNS is disabled." %}
-
@@ -307,7 +307,7 @@

{% trans "PowerDNS is disabled." %}
-
@@ -337,7 +337,7 @@

{% trans "PowerDNS is disabled." %} ng-model="recordName">
-