114 lines
3.1 KiB
HTML
114 lines
3.1 KiB
HTML
{% extends "base.html" %}
|
|
{% load i18n %}
|
|
{% load misc %}
|
|
|
|
{% block content %}
|
|
|
|
<div id="home">
|
|
|
|
{% if messages %}
|
|
<ul class="messages">
|
|
{% for message in messages %}
|
|
<li{% if message.tags %} class="{{ message.tags }}"{% endif %}>{{ message }}</li>
|
|
{% endfor %}
|
|
</ul>
|
|
{% endif %}
|
|
|
|
<div id="authbuttons">
|
|
Choisissez votre établissement :<br /><br />
|
|
{% if default_idp %}
|
|
<a class="bigbutton" id="default-idp" title="{{ default_idp.name }}" href="/sso?entity_id={{ default_idp.entity_id|urlfullencode }}">{{ default_idp.name }}</a>
|
|
<a class="bigbutton" id="other-idps" href="#" onclick="$('#popup').show().modal()">Autres établissements</a>
|
|
{% else %}
|
|
<a class="bigbutton" id="default-idp" title="" href="#" style="display: none;"></a>
|
|
<a class="bigbutton" id="other-idps" href="#" onclick="$('#popup').show().modal()">Liste des établissements</a>
|
|
{% endif %}
|
|
</div> <!-- #authbuttons -->
|
|
|
|
<div id="popup">
|
|
<div>
|
|
<a id="close" href="#" onclick="$.modal.close(); $('#popup').hide(); return false;">Fermer</a>
|
|
<h3>Liste des établissements</h3>
|
|
<ul>
|
|
{% for p in idp_providers %}
|
|
<li><a href="/sso?entity_id={{ p.entity_id|urlfullencode }}"
|
|
title="Authentification via {{ p.name }}"
|
|
class="idp-link"
|
|
data-idp="{{ p.entity_id }}"
|
|
>{{ p.name }}</a></li>
|
|
{% endfor %}
|
|
</ul>
|
|
</div>
|
|
</div><!-- #popup -->
|
|
|
|
<p class="disclaimer">
|
|
{% block disclaimer %}
|
|
{% endblock %}
|
|
</p>
|
|
|
|
{% 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').text(idp.name);
|
|
$('a#default-idp').attr({
|
|
href: idp.href,
|
|
title: "Authentification via " + idp.name,
|
|
style: "",
|
|
});
|
|
});
|
|
{% 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 #}
|
|
|
|
</div><!-- #home -->
|
|
|
|
{% endblock %}
|