112 lines
3.1 KiB
HTML
112 lines
3.1 KiB
HTML
{% extends "base.html" %}
|
|
{% load i18n %}
|
|
{% load misc %}
|
|
|
|
{% block home-navbar %}
|
|
<div data-role="navbar">
|
|
<ul>
|
|
<li><a href="#informations" data-icon="info" data-iconpos="top"
|
|
data-transition="slide">Informations</a></li>
|
|
<li><a href="#conditions" data-icon="alert" data-iconpos="top"
|
|
data-transition="slide">Conditions d'utilisation</a></li>
|
|
{% if mailform %}
|
|
<li><a href="/mail" data-icon="gear" data-iconpos="top"
|
|
data-transition="slide" data-ajax="false">En cas de soucis</a></li>
|
|
{% endif %}
|
|
|
|
</ul>
|
|
</div>
|
|
{% endblock %}
|
|
|
|
{% block content %}
|
|
|
|
<nav>
|
|
|
|
<p>
|
|
{% if default_idp %}
|
|
<a id="default-idp" data-ajax="false" href="/sso?entity_id={{ default_idp.entity_id|urlfullencode }}"
|
|
data-role="button" data-icon="arrow-r" data-iconpos="bottom">{{ default_idp.name }}</a>
|
|
{% else %}
|
|
<a id="default-idp" data-ajax="false" href="#"
|
|
data-role="button" data-icon="arrow-r" data-iconpos="bottom"
|
|
style="display: none;">Default</a>
|
|
{% endif %}
|
|
</p>
|
|
|
|
<ul data-role="listview" data-inset="true" data-filter="true" data-filter-placeholder="Recherche">
|
|
{% for p in idp_providers %}
|
|
<li><a
|
|
class="idp-link" data-idp="{{ p.entity_id }}"
|
|
data-ajax="false"
|
|
href="/sso?entity_id={{ p.entity_id|urlfullencode }}"
|
|
title="Authentification via {{ p.name }}">{{ p.name }}</a>
|
|
</li>
|
|
{% endfor %}
|
|
</ul>
|
|
|
|
</nav>
|
|
|
|
{% if disco_stores_read %}
|
|
<!-- discovery -->
|
|
<script type="text/javascript" src="{{ MEDIA_URL }}simple-disco-store/jquery.qs.js"></script>
|
|
<script type="text/javascript" src="{{ MEDIA_URL }}simple-disco-store/discoquery.js"></script>
|
|
<script type="text/javascript" src="{{ MEDIA_URL }}simple-disco-store/debug.js"></script>
|
|
<script>
|
|
|
|
idps = {
|
|
{% for p in idp_providers %}
|
|
"{{ p.entity_id }}": {
|
|
name: "{{ p.name }}",
|
|
href: "/sso?entity_id={{ p.entity_id|urlfullencode }}",
|
|
},
|
|
{% endfor %}
|
|
};
|
|
|
|
function query() {
|
|
{% for store in disco_stores_read %}
|
|
$.disco_query(
|
|
"https://{{https_hostname}}/authsaml2/metadata",
|
|
"{{ store }}",
|
|
"https://{{https_hostname}}{{ MEDIA_URL }}simple-disco-store/response.html",
|
|
function (entity_id, store, auth) {
|
|
idp = idps[entity_id];
|
|
// alert("idp = " + JSON.stringify(idp));
|
|
$('a#default-idp span.ui-btn-text').text(idp.name);
|
|
$('a#default-idp').attr({
|
|
href: idp.href,
|
|
title: "Authentification via " + idp.name,
|
|
});
|
|
});
|
|
{% endfor %}
|
|
}
|
|
|
|
function set(idp_entity_id) {
|
|
{% for store in disco_stores_write %}
|
|
$.disco_set(
|
|
"https://{{https_hostname}}/authsaml2/metadata",
|
|
idp_entity_id,
|
|
"{{ store }}",
|
|
"https://{{https_hostname}}{{ MEDIA_URL }}simple-disco-store/response.html",
|
|
function (entity_id, store, auth) {
|
|
// alert("set: store " + entity_id + " on " + store);
|
|
});
|
|
{% endfor %}
|
|
}
|
|
|
|
$(document).ready(function() {
|
|
query();
|
|
});
|
|
|
|
$('.idp-link').click(function () {
|
|
var a = $(this);
|
|
set(a.data('idp'));
|
|
setTimeout(function () { window.location.href = a.attr('href'); }, 3000);
|
|
return false;
|
|
});
|
|
|
|
</script>
|
|
{% endif %}{# disco_stores_read #}
|
|
|
|
{% endblock %}
|
|
|