add domain name check, fixes #308
This commit is contained in:
parent
946ecfdea8
commit
f3d2d031b0
20
nsupdate/main/migrations/0011_auto_20170526_2113.py
Normal file
20
nsupdate/main/migrations/0011_auto_20170526_2113.py
Normal file
@ -0,0 +1,20 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.core.validators
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('main', '0010_auto_20151229_1717'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='domain',
|
||||
name='name',
|
||||
field=models.CharField(help_text='Name of the zone where dynamic hosts may get added', unique=True, max_length=255, verbose_name='name', validators=[django.core.validators.RegexValidator(regex=b'([a-zA-Z0-9-_]+\\.)+[a-zA-Z0-9-_]{2,}', message='Invalid domain name')]),
|
||||
),
|
||||
]
|
@ -85,6 +85,7 @@ class Domain(models.Model):
|
||||
name = models.CharField(
|
||||
_("name"),
|
||||
max_length=255, # RFC 2181 (and also: max length of unique fields)
|
||||
validators=[RegexValidator(regex=r"([a-zA-Z0-9-_]+\.)+[a-zA-Z0-9-_]{2,}", message=_("Invalid domain name"))],
|
||||
unique=True,
|
||||
help_text=_("Name of the zone where dynamic hosts may get added"))
|
||||
nameserver_ip = models.GenericIPAddressField(
|
||||
|
@ -2,6 +2,11 @@
|
||||
{% load i18n %}{% load bootstrap %}
|
||||
|
||||
{% block content %}
|
||||
<div class="alert alert-warning" role="alert">
|
||||
<i class="fa fa-exclamation-triangle"
|
||||
aria-hidden="true"></i> {% trans "This feature is for advanced users only! To use this feature, you need control over at least one nameserver which is able to accept dynamic updates (RFC 2136)." %}
|
||||
<i class="fa fa-exclamation-triangle" aria-hidden="true"></i>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="well well-sm">
|
||||
@ -17,19 +22,22 @@
|
||||
<div class="well well-sm">
|
||||
<h3>{% trans "Help" %}</h3>
|
||||
<p>
|
||||
{% blocktrans trimmed %}
|
||||
Here you can add new domains (zones) which you control (and this is only useful if you
|
||||
have some own zone which you can update automatically).
|
||||
{% endblocktrans %}
|
||||
{% blocktrans trimmed %}
|
||||
Here you can add new domains (zones) which you control (and this is only
|
||||
useful if you
|
||||
have some own zone which you can update automatically).
|
||||
{% endblocktrans %}
|
||||
</p>
|
||||
<p>
|
||||
{% blocktrans trimmed %}
|
||||
You need to be able to configure the primary master nameserver of the zone so it accepts
|
||||
dynamic updates (via RFC 2136 "dynamic update" protocol) if the correct update secret is presented.
|
||||
{% endblocktrans %}
|
||||
{% blocktrans trimmed %}
|
||||
You need to be able to configure the primary master nameserver of the zone
|
||||
so it accepts
|
||||
dynamic updates (via RFC 2136 "dynamic update" protocol) if the correct
|
||||
update secret is presented.
|
||||
{% endblocktrans %}
|
||||
</p>
|
||||
<p>
|
||||
{% trans "We'll show you configuration examples after you add a domain." %}
|
||||
{% trans "We'll show you configuration examples after you add a domain." %}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -85,7 +85,7 @@
|
||||
<div class="col-md-12">
|
||||
<h3>
|
||||
{% trans "Domains (yours first, then public)" %}
|
||||
<a href="{% url 'add_domain' %}" class="btn btn-primary btn-sm">{% trans "Add Domain" %}</a>
|
||||
<a href="{% url 'add_domain' %}" class="btn btn-default btn-sm">{% trans "Add Domain" %}</a>
|
||||
</h3>
|
||||
<table class="table">
|
||||
<thead>
|
||||
|
Loading…
x
Reference in New Issue
Block a user