make adding a domain workflow more similar to adding a host

don't ask for the secret in the first form, just autocreate one and show the configuration example with it.
This commit is contained in:
Thomas Waldmann 2013-11-24 04:14:31 +01:00
parent 49007c60bd
commit 972a411ef4
6 changed files with 17 additions and 7 deletions

View File

@ -22,7 +22,8 @@ class EditHostForm(forms.ModelForm):
class CreateDomainForm(forms.ModelForm):
class Meta(object):
model = Domain
exclude = ['created_by']
fields = ['domain', 'nameserver_ip', 'nameserver_update_algorithm',
'public', 'available', 'comment']
widgets = {
'domain': forms.widgets.TextInput(attrs=dict(autofocus=None)),
}

View File

@ -65,7 +65,8 @@ class Domain(models.Model):
help_text="Shared secret that allows updating this zone (base64 encoded)")
nameserver_update_algorithm = models.CharField(
max_length=16, # see elements of UPDATE_ALGORITHM_CHOICES
default=UPDATE_ALGORITHM_DEFAULT, choices=UPDATE_ALGORITHM_CHOICES)
default=UPDATE_ALGORITHM_DEFAULT, choices=UPDATE_ALGORITHM_CHOICES,
help_text="HMAC_SHA512 is fine for bind9 (you can change this later, if needed)")
public = models.BooleanField(
default=False,
help_text="Check to allow any user to add dynamic hosts to this zone - "

View File

@ -7,6 +7,10 @@
<div class="col-lg-8">
<h3>Edit Domain</h3>
<p>You can't change the domain name. If you want to have another domain name, you have to delete this domain and create a new one.</p>
<p>
Please note that update algorithm and update secret need to match.
Just create a new secret after submitting this form with a changed update algorithm.
</p>
<form method="post" action="">
{% csrf_token %}
{{ form|bootstrap }}

View File

@ -57,10 +57,11 @@
<div class="well well-sm">
<h3>Help</h3>
<p>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).</p>
<p>You need to configure the primary master nameserver of the zone so it accepts dynamic updates
if the correct update key is presented (which is just a shared secret between the nameserver
and this service).
have some own zone which you can update automatically).
</p>
<p>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.
We'll show you configuration examples after you add a domain.
</p>
</div>
</div>

View File

@ -8,9 +8,12 @@
<h3>Nameserver Shared Secret Generated <small><br>
<a href="{% url 'domain_overview' %}"><i class="fa fa-angle-double-left"></i> back to overview</a></small></h3>
<p>New nameserver shared secret generated for you. Everytime you visit this page a new secret will be generated and the old one becomes invalid.</p>
<p>Algorithm: <b>{{ object.get_bind9_algorithm }}</b></p>
<p>Secret: <b>{{ shared_secret }}</b></p>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-12">
<div class="well">
<h3>How to configure your bind9 nameserver to accept dynamic DNS updates?</h3>

View File

@ -241,7 +241,7 @@ class DomainOverwievView(CreateView):
return super(DomainOverwievView, self).dispatch(*args, **kwargs)
def get_success_url(self):
return reverse('domain_overview')
return reverse('generate_ns_secret_view', args=(self.object.pk,))
def form_valid(self, form):
self.object = form.save(commit=False)