Skip to content

Commit

Permalink
Merge branch 'v2.3.5-dev' into v2.3.5-dev
Browse files Browse the repository at this point in the history
  • Loading branch information
master3395 authored Nov 11, 2023
2 parents c67eb83 + 0994d61 commit 5e2699b
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 14 deletions.
2 changes: 1 addition & 1 deletion baseTemplate/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
# Create your views here.

VERSION = '2.3'
BUILD = 4
BUILD = 3


@ensure_csrf_cookie
Expand Down
2 changes: 1 addition & 1 deletion cli/cliParser.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def prepareArguments(self):
### Additional Arguments for user manager

parser.add_argument('--firstName', help='First name while creating user.')
parser.add_argument('--lastName', help='First name while creating user.')
parser.add_argument('--lastName', help='Last name while creating user.')
parser.add_argument('--websitesLimit', help='Website limit while creating user.')
parser.add_argument('--selectedACL', help='Select ACL while creating user.')
parser.add_argument('--securityLevel', help='Set security level while creating user.')
Expand Down
12 changes: 12 additions & 0 deletions dns/dnsManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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'])
Expand Down Expand Up @@ -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
Expand Down
20 changes: 10 additions & 10 deletions dns/templates/dns/addDeleteDNSRecords.html
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ <h3>{% trans "PowerDNS is disabled." %}
</div>

<div class="col-sm-3 aRecord">
<input placeholder="{% trans 'TTL' %}" type="number" class="form-control"
<input placeholder="{% trans 'TTL' %}" type="number" min="0" max="86400" class="form-control"
ng-model="ttl" required>
</div>

Expand All @@ -114,7 +114,7 @@ <h3>{% trans "PowerDNS is disabled." %}
</div>

<div class="col-sm-3 aaaaRecord">
<input placeholder="{% trans 'TTL' %}" type="number" class="form-control"
<input placeholder="{% trans 'TTL' %}" type="number" min="0" max="86400" class="form-control"
ng-model="ttl" required>
</div>

Expand All @@ -141,7 +141,7 @@ <h3>{% trans "PowerDNS is disabled." %}
</div>

<div class="col-sm-3 cNameRecord">
<input placeholder="{% trans 'TTL' %}" type="number" class="form-control"
<input placeholder="{% trans 'TTL' %}" type="number" min="0" max="86400" class="form-control"
ng-model="ttl" required>
</div>

Expand All @@ -167,7 +167,7 @@ <h3>{% trans "PowerDNS is disabled." %}
</div>

<div class="col-sm-2 mxRecord">
<input placeholder="{% trans 'TTL' %}" type="number" class="form-control"
<input placeholder="{% trans 'TTL' %}" type="number" min="0" max="86400" class="form-control"
ng-model="ttl" required>
</div>

Expand Down Expand Up @@ -199,7 +199,7 @@ <h3>{% trans "PowerDNS is disabled." %}
</div>

<div class="col-sm-3 spfRecord">
<input placeholder="{% trans 'TTL' %}" type="number" class="form-control"
<input placeholder="{% trans 'TTL' %}" type="number" min="0" max="86400" class="form-control"
ng-model="ttl" required>
</div>

Expand All @@ -226,7 +226,7 @@ <h3>{% trans "PowerDNS is disabled." %}
</div>

<div class="col-sm-3 txtRecord">
<input placeholder="{% trans 'TTL' %}" type="number" class="form-control"
<input placeholder="{% trans 'TTL' %}" type="number" min="0" max="86400" class="form-control"
ng-model="ttl" required>
</div>

Expand All @@ -253,7 +253,7 @@ <h3>{% trans "PowerDNS is disabled." %}
</div>

<div class="col-sm-3 soaRecord">
<input placeholder="{% trans 'TTL' %}" type="number" class="form-control"
<input placeholder="{% trans 'TTL' %}" type="number" min="0" max="86400" class="form-control"
ng-model="ttl" required>
</div>

Expand All @@ -280,7 +280,7 @@ <h3>{% trans "PowerDNS is disabled." %}
</div>

<div class="col-sm-3 nsRecord">
<input placeholder="{% trans 'TTL' %}" type="number" class="form-control"
<input placeholder="{% trans 'TTL' %}" type="number" min="0" max="86400" class="form-control"
ng-model="ttl" required>
</div>

Expand All @@ -307,7 +307,7 @@ <h3>{% trans "PowerDNS is disabled." %}
</div>

<div class="col-sm-2 srvRecord">
<input placeholder="{% trans 'TTL' %}" type="number" class="form-control"
<input placeholder="{% trans 'TTL' %}" type="number" min="0" max="86400" class="form-control"
ng-model="ttl" required>
</div>

Expand Down Expand Up @@ -337,7 +337,7 @@ <h3>{% trans "PowerDNS is disabled." %}
ng-model="recordName">
</div>
<div class="col-sm-3 caaRecord">
<input placeholder="{% trans 'TTL' %}" type="number" class="form-control"
<input placeholder="{% trans 'TTL' %}" type="number" min="0" max="86400" class="form-control"
ng-model="ttl" required>
</div>
<div class="col-sm-3 caaRecord">
Expand Down
4 changes: 2 additions & 2 deletions userManagment/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,12 @@ def submitUserCreation(request):
selectedACL = data['selectedACL']

if ACLManager.CheckRegEx("^[\w'\-,.][^0-9_!¡?÷?¿/\\+=@#$%ˆ&*(){}|~<>;:[\]]{2,}$", firstName) == 0:
data_ret = {'status': 0, 'createStatus': 0, 'error_message': 'First Name can only contain Alphabets and should be more then 2 characters..'}
data_ret = {'status': 0, 'createStatus': 0, 'error_message': 'First Name can only contain alphabetic characters, and should be more than 2 characters long...'}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)

if ACLManager.CheckRegEx("^[\w'\-,.][^0-9_!¡?÷?¿/\\+=@#$%ˆ&*(){}|~<>;:[\]]{2,}$", lastName) == 0:
data_ret = {'status': 0, 'createStatus': 0, 'error_message': 'First Name can only contain Alphabets and should be more then 2 characters..'}
data_ret = {'status': 0, 'createStatus': 0, 'error_message': 'Last Name can only contain alphabetic characters, and should be more than 2 characters long...'}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)

Expand Down

0 comments on commit 5e2699b

Please sign in to comment.