Disallow same nameserver with multiple glues
This commit is contained in:
parent
c1afcbfa3a
commit
2fc672690f
|
@ -121,6 +121,16 @@ class NameserverForm(MntFormMixin, WhoisObjectFormMixin, forms.ModelForm):
|
|||
if not found:
|
||||
raise forms.ValidationError("You have glue IPs set, but this domain is not under a domain you control.")
|
||||
|
||||
if ipv4 or ipv6:
|
||||
try:
|
||||
ns = Nameserver.objects.get(Q(name=name) & (Q(glueIPv4__isnull=False) | Q(glueIPv6__isnull=False)))
|
||||
if self._create or ns.pk != self.instance.pk:
|
||||
nsMnts = ", ".join(n.handle for n in ns.mnt_by.all())
|
||||
|
||||
raise forms.ValidationError("Only one nameserver for this domain can have glue records and one already exists (maintained by %s)" % nsMnts)
|
||||
except Nameserver.DoesNotExist:
|
||||
pass
|
||||
|
||||
failedMnts = set()
|
||||
for ns in Nameserver.objects.filter(name=name, mnt_by__in=mntBy):
|
||||
if self._create or self.instance.pk != ns.pk:
|
||||
|
|
Loading…
Reference in New Issue