{% extends "authentic2/base-page.html" %}
{% load i18n staticfiles %}

{% block extra_styles %}
<link rel="stylesheet" type="text/css" href="{% static "authentic2_auth_msp/css/screen.msp.css" %}" />
{% endblock %}

{% block title %}
Gestion du compte
{% endblock %}

{% block content %}
<div id="left">
  <div class="block">
    <h2>Profil</h2>
    <div id="profile">
      {% if profile %}
      <dl>
        {% for key, values in profile %}
        <dt>{{ key|capfirst }}</dt>
        <dd>{% if values|length == 1 %}{{ values.0 }}{% else %}
          <ul>
            {% for value in values %}
            <li>{{ value }}</li>
            {% endfor %}
          </ul>
          {% endif %}
        </dd>
        {% endfor %}
      </dl>
      {% endif %}
    </div>
  </div>
  {% if frontends_block_by_id.fc %}
  <div class="block">
    <h2>{{ frontends_block_by_id.fc.name }}</h2>
    {{ frontends_block_by_id.fc.content }}
  </div>
  {% endif %}
</div>
<div id="right">
  <div class="block" id="account-management">
    <h2>Gestion du compte</h2>
    <ul>
      <li><a href="{% url 'email-change' %}">Modifier le courriel associé</a></li>
      <li>
        <a href="{% url 'password_change' %}">
        {% if user.has_usable_password %}
          Modifier le mot de passe
        {% else %}
          Définir le mot de passe
        {% endif %}
        </a>
      </li>
      <li><a href="{% url 'profile_edit' %}">Éditer les données du compte</a></li>
      <li><a href="{% url 'delete_account' %}">Supprimer le compte</a></li>
    </ul>
  </div>
  {% if federation_management %}
  <div class="block" id="federation-management">
    <h2>{% trans "Federation management" %}</h2>
    <ul>
      {% for federation in federation_management %}
      <li>
        <form method="post" action="{{ federation.url }}">
          {% csrf_token %}
          <span class="name">{{ federation.name }}</span>
          {% for key, value in federation.hidden_inputs.iteritems %}
          <input type="hidden" name="{{ key }}" value="{{ value }}"/>
          {% endfor %}
          {% for button_name, button_label in federation.buttons %}
          <button name="{{ button_name }}" class="{{ button_name }}">{{ button_label }}</button>
          {% endfor %}
        </form>
      </li>
      {% endfor %}
    </ul>
  </div>
  {% endif %}
</div>
<br class="clear" />
{% endblock %}
