separate ip v4 and v6 update fields / button, prepopulated with currently detected addresses

This commit is contained in:
Thomas Waldmann 2013-10-27 09:25:59 +01:00
parent f30d283792
commit 456f5fd2b7

View File

@ -23,25 +23,42 @@
</div> </div>
<div class="col-lg-4"> <div class="col-lg-4">
<h3>Update Nameserver Entry</h3> <h3>Update Nameserver Entry</h3>
<p>Usually you configure your router to follow the dyndns2 protocol. But if you know what you are doing, and you want to update it by hand, you can do it here.<br>If you don't specify an IP address, we use your remote address.</p> <p>Usually you configure your router to follow the dyndns2 protocol.
But if you know what you are doing, and you want to update it by hand, you can do it here.
<br>
We populated the input fields with your current remote IP addresses which we detected.
</p>
<div class="form-group"> <div class="form-group">
<label>IPv4 or IPv6</label> <label>Set new IPv4 address</label>
<input class="form-control" type="text" id="myip" name="myip" placeholder="use remote address"> <input class="form-control" type="text" id="myipv4" name="myipv4" placeholder="give new ipv4 address" value="{{ request.session.ipv4 }}" required>
</div> </div>
<button type="button" class="btn btn-primary" onclick="update_host('{{ host.get_fqdn }}')">DNS Update</button> <span id="update_result"></span> <button type="button" class="btn btn-primary" onclick="update_host_v4('{{ host.get_fqdn }}')">Apply</button> <span id="update_result_v4"></span>
<p></p>
<div class="form-group">
<label>Set new IPv6 address</label>
<input class="form-control" type="text" id="myipv6" name="myipv6" placeholder="give new ipv6 address" value="{{ request.session.ipv6 }}" required>
</div>
<button type="button" class="btn btn-primary" onclick="update_host_v6('{{ host.get_fqdn }}')">Apply</button> <span id="update_result_v6"></span>
<script> <script>
update_host = function(host) { update_host_v4 = function(host) {
$('#update_result').text('updating...'); $('#update_result_v4').text('updating...');
$.get( "{% url 'nic_update_authorized' %}", { myip: $('#myip').val(), hostname: host } ) $.get( "{% url 'nic_update_authorized' %}", { myip: $('#myipv4').val(), hostname: host } )
.done(function( data ) { .done(function( data ) {
$('#update_result').text(data); $('#update_result_v4').text(data);
}).fail(function( data ) { }).fail(function( data ) {
$('#update_result').text('error'); $('#update_result_v4').text('error');
});
}
update_host_v6 = function(host) {
$('#update_result_v6').text('updating...');
$.get( "{% url 'nic_update_authorized' %}", { myip: $('#myipv4').val(), hostname: host } )
.done(function( data ) {
$('#update_result_v6').text(data);
}).fail(function( data ) {
$('#update_result_v6').text('error');
}); });
} }
</script> </script>
<p>Or use this url to set the ip via url: <br><a href="{% url 'nic_update_authorized' %}?hostname={{ host.get_fqdn }}">Right Click &rarr; Copy Link Address</a></p>
</div> </div>
</div> </div>
<hr> <hr>