{% extends "layout2.html" %} {% load i18n %} {% load static %} {% block css_include %} {% endblock %} {% block js_include %} {% endblock %} {% block content %} {% csrf_token %} {% translate "TLS Profile" %} {# Print form errors correctly #} {% if form.non_field_errors %} {% translate "Form errors" %} {{ form.non_field_errors|safe }} {% endif %} {# If there is save/configuration errors #} {% if save_error %} {% translate "Advanced informations" %} {% translate "Message" %} {% translate "Configuration error" %} {{ save_error.0 }} {{ save_error.1 }} {% endif %} {% translate "General" %} {% translate "TLS Server options" %} {% translate "Friendly name" %} {{form.name}} {{form.name.errors|safe}} {{form.x509_certificate.label}} {{form.x509_certificate}} {{form.x509_certificate.errors|safe}} {{form.verify_client.label}} {{form.verify_client}} {{form.verify_client.errors|safe}} {{form.ca_cert.label}} {{form.ca_cert}} {{form.ca_cert.errors|safe}} {% translate "Browsers compatibility" %} {{form.compatibility}} {{form.compatibility.errors|safe}} Advanced {% translate "Allowed cipher protocols" %} {{form.protocols}} {{form.protocols.errors|safe}} {% translate "Allowed ciphers" %} {{form.cipher_suite}} {{form.cipher_suite.errors|safe}} {% translate "Advertise protocol list" %} {{form.alpn}} {{form.alpn.errors|safe}} {% endblock %} {% block jquery_code %} if (!String.prototype.endsWith) { String.prototype.endsWith = function(searchString, position) { var subjectString = this.toString(); if (typeof position !== 'number' || !isFinite(position) || Math.floor(position) !== position || position > subjectString.length) { position = subjectString.length; } position -= searchString.length; var lastIndex = subjectString.lastIndexOf(searchString, position); return lastIndex !== -1 && lastIndex === position; }; } $(function() { var cipher_choices = {{ cipher_choices|safe }}; var protocols_handler = {{ protocols_handler|safe }}; $('.select2').select2(); /* If browsers compatibility is not custom, * hide and disable protocol choice and ciphers area * Else show and enable those fields */ $('#id_compatibility').on('change', function(e) { var value = $(this).val(); if( value !== "custom" ) { $('#id_protocols').val(protocols_handler[value].split(',')).trigger('change.select2'); $('#id_cipher_suite').val(cipher_choices[value]); $('#id_protocols').select2({disabled: true}); $('#id_cipher_suite').prop("readonly", true); } else { $('#id_protocols').select2({disabled: false}); $('#id_cipher_suite').prop("readonly", false); $('.browsers-compat').show(); } }); $('#id_compatibility').trigger('change'); /* If verify client is none, show CA cert input area * else hide it */ $('#id_verify_client').on('change', function(e) { var value = $(this).val(); if( value !== "none" ) { $('.require-cert').show(); } else { $('.require-cert').hide(); } }); $('#id_verify_client').trigger('change'); /* Enable protocols choice just before form submit */ $('#tls_edit_form').on('submit', function(e) { $('#id_protocols').prop({disabled: false}); }); }); // end of function() {% endblock %}
{{ save_error.0 }}
{{ save_error.1 }}