This repository has been archived on 2023-02-21. You can view files and clone it, but cannot push or open issues or pull requests.
authentic2-pratic/src/authentic2_pratic/templates/authentic2_pratic/login.html

60 lines
2.2 KiB
HTML

{% load i18n authentic2 django_select2_tags %}
{% addtoblock "js" %}{% import_django_select2_js %}{% endaddtoblock %}
{% addtoblock "css" %}{% import_django_select2_css %}{% endaddtoblock %}
<!--
issuer dn: {{ request.ssl_info.issuer_dn }}
subject dn: {{ request.ssl_info.subject_dn }}
-->
<div id="pratic-login">
{% if request.ssl_info and request.ssl_info.users %}
<style>
.pratic-ssl-user-auth, .pratic-ssl-collectivity-auth {
background: lightblue;
color: black;
border: 1px solid black;
padding: 10px;
}
.pratic-ssl-user-auth-button {
float: right;
}
</style>
<div class="pratic-ssl-user-auth">{% trans "You are authenticated with certificate of users :" %}
<ul>
{% for user in request.ssl_info.users %}
<li>
<p>
<form method="post">
<span>{% blocktrans with collectivity=user.collectivity %}<em>{{user}}</em> from <em>{{collectivity}}</em>{% endblocktrans %}</span>
{% csrf_token %}
<input type="hidden" name="ssl-user" value="{{ user.pk }}"/>
<input type="submit" name="{{ submit_name }}" value="{% trans "Log in" %}" class="pratic-ssl-user-auth-button"/>
</form>
</p>
</li>
{% endfor %}
</ul>
</div>
{% endif %}
{% if request.ssl_info and request.ssl_info.collectivity %}
<p class="pratic-ssl-collectivity-auth">
{% with collectivities=request.ssl_info.collectivity counter=collectivities|length %}
{% if counter < 2 %}
{% blocktrans with first=collectivities.0 %}You are authenticated with certificate of collectivity <em>{{ first }}.</em> It has been pre-selected for you.{% endblocktrans %}
{% else %}
{% blocktrans with all=collectivities|join:", " %}You are authenticated with certificate of collectivities <em>{{ all }}.</em> It has been pre-selected for you.{% endblocktrans %}
{% endif %}
{% endwith %}
</p>
{% endif %}
<form method="post">
{% csrf_token %}
{{ form.as_p }}
<input type="submit" name="pratic-login" value="{% trans "Log in" %}"/>
<input type="submit" name="pratic-cancel" value="{% trans "Cancel" %}"/>
</form>
</div>