2013-10-27 09:54:16 +01:00

69 lines
3.8 KiB
HTML

{% extends "base.html" %}
{% load bootstrap %}
{% block content %}
<div class="row">
<h3>{{ host.get_fqdn }} <br><small><a href="{% url 'overview' %}"><i class="icon-double-angle-left"></i> back to overview</a></small></h3>
<div class="col-lg-4">
<h3>Edit Host</h3>
<p>You can only change the comment. If you want to have another host name, you have to delete this host and create a new one.</p>
<form method="post" action="">
{% csrf_token %}
{{ form|bootstrap }}
<button type="submit" class="btn btn-primary">Update</button>
</form>
</div>
<div class="col-lg-4">
<h3>Generate New Secret</h3>
<p>We store your update secret salted and hashed, so if you forget or lose it you will have to create a new one.</p>
<form action="{% url 'generate_secret_view' host.pk %}" method="get">
<button type="submit" class="btn btn-primary">Generate New</button>
</form>
</div>
<div class="col-lg-4">
<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 manually, you can do it here.
<br>
We populated the input fields for the new addresses with your currently detected remote addresses.
</p>
<div class="form-group">
<label>Current IPv4 address from master nameserver</label>
<input class="form-control" type="text" id="current_ipv4" name="current_ipv4" value="{{ host.getIPv4 }}" disabled>
<label>Set new IPv4 address</label>
<input class="form-control" type="text" id="myipv4" name="myipv4" placeholder="give new ipv4 address" value="{{ request.session.ipv4 }}" required>
</div>
<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>Current IPv6 address from master nameserver</label>
<input class="form-control" type="text" id="current_ipv6" name="current_ipv6" value="{{ host.getIPv6 }}" disabled>
<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>
update_host_v4 = function(host) {
$('#update_result_v4').text('updating...');
$.get( "{% url 'nic_update_authorized' %}", { myip: $('#myipv4').val(), hostname: host } )
.done(function( data ) {
$('#update_result_v4').text(data);
}).fail(function( data ) {
$('#update_result_v4').text('error');
});
}
update_host_v6 = function(host) {
$('#update_result_v6').text('updating...');
$.get( "{% url 'nic_update_authorized' %}", { myip: $('#myipv6').val(), hostname: host } )
.done(function( data ) {
$('#update_result_v6').text(data);
}).fail(function( data ) {
$('#update_result_v6').text('error');
});
}
</script>
</div>
</div>
{% endblock %}