{% extends "layout2.html" %} {% load i18n %} {% load static %} {% block css_include %} {% endblock %} {% block js_include %} {% endblock %} {% block content %}
{% csrf_token %}
{% if form.non_field_errors or save_error or connection_error or success %}
{# 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 %} {# If there is connection test errors #} {% if connection_error %} {% endif %} {# If there is success message #} {% if success %} {% endif %}
{% endif %}

 {% translate "LDAP Repository edition" %}

{% endblock %} {% block jquery_code %} var custom_attributes_form_td = `{{custom_attributes_form.as_table_td|safe}}`; function show_hide_custom_attributes_table_header() { var numRows = $('#custom_attributes_table tbody tr').length; if (numRows === 0) { $('#custom_attributes_table').addClass('collapse'); } else { $('#custom_attributes_table').removeClass('collapse'); } } /* All events to refresh (re-apply) after a table is modified */ function refresh_table_events() { show_hide_custom_attributes_table_header(); /* Function used to delete an object .btnDelete */ $('.btnDelete').on('click', function(e) { $(this).parent().remove(); var numRows = $('#custom_attributes_table tbody tr').length; if (numRows === 0) { $('#custom_attributes_table').addClass('collapse'); } }); } 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; }; } /* Initialize select2 objects */ $('.select2').select2(); /* Switchery mandatory code */ var elems = Array.prototype.slice.call(document.querySelectorAll('.js-switch')); elems.forEach(function(html) { var switchery = new Switchery(html, { 'color': '#FA9834', }); }); /* Change port value according to chosen encryption scheme */ $('#id_encryption_scheme').on("change", function(e) { var port = 0; switch($(this).val()) { case "none": $(id_port).val(389); break; case "ldaps": $(id_port).val(636); break; case "start-tls": $(id_port).val(389); } }); /* Show OAuth2 options if oauth2 enabled */ $('#id_enable_oauth2').on("change", function(e) { if( document.querySelector('#id_enable_oauth2').checked ) { $('.oauth2').show(); } else { $('.oauth2').hide(); } }); $('#id_enable_oauth2').trigger("change"); $('#id_base_dn').on("change", function(e) { $('#user_dn').val($(this).val()); $('#group_dn').val($(this).val()); }); $('#id_base_dn').trigger("change"); function handle_form_errors(data){ if (typeof(data['form_errors']) !== 'undefined'){ $('.errorlist').remove(); $.each(data['form_errors'], function(field_name, error_list){ field_selector = $('#id_'+field_name); var ul = $('