{% extends "base.html" %}
{% load i18n %}

{% block title %}
{% trans "Account Management" %}
{% endblock %}

{% block content %}
<div id="left">
  <div class="block">
    <h2>{% trans "Profile" %}</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>
  <div class="block">
    <h2>{% trans "Account Management" %}</h2>
    <ul class="account-management">
      <li><a href="{% url 'email-change' %}">{% trans "Change email" %}</a></li>
      <li><a href="{% url 'profile_edit' %}">{% trans "Edit profile" %}</a></li>
      <li><a href="{% url 'delete_account' %}">{% trans "Delete profile" %}</a></li>
    </ul>
  </div>
</div>
<div id="right">
  <div class="block">
  <h2>{% trans "Credentials" %}</h2>
  {% for html_block in frontends_block %}
    {{ html_block|safe }}
  {% endfor %}
  </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 %}

