{% 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 %} {% endif %}
{% 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 %}