{% extends "account/_layout.html" %}

{% load i18n %}

{% block page_title %}{% trans "Set Password" %} | {{ block.super }}{% endblock %}

{% block main_content %}
  <div class="ui page stacked grid centered">
    <div class="ten wide column">
      <h1>{% trans "Set Password" %}</h1>

      <div class="ui tall stacked segment">
        <form method="post" action="{% url 'account_set_password' %}"
              class="ui form {% if form.errors %}error{% endif %} password_set">
          {% csrf_token %}

          {% comment %}
          {% if form.errors %}
            <div class="ui error message float-right">
              {% for field_name, errors in form.errors.items %}
                {% for error in errors %}
                  <p>{{ error }}</p>
                {% endfor %}
              {% endfor %}
            </div>
          {% endif %}
          {% endcomment %}

          <div class="field {% if form.errors.password1 %}error{% endif %}">
            {{ form.password1.label_tag }}
            {{ form.password1 }}

            {% if form.errors.password1 %}
              <div class="ui pointing red basic label">
                {% for error in form.errors.password1 %}
                  <p>{{ error }}</p>
                {% endfor %}
              </div>
            {% endif %}
          </div>


          <div class="field {% if form.errors.password2 %}error{% endif %}">
            {{ form.password2.label_tag }}
            {{ form.password2 }}
            {% if form.errors.password2 %}
              <div class="ui pointing red basic label">
                {% for error in form.errors.password2 %}
                  <p>{{ error }}</p>
                {% endfor %}
              </div>
            {% endif %}
          </div>

          <button type="submit" name="action" class="ui button primary">{% trans "Set password" %}</button>
        </form>
      </div>
    </div>
  </div>
{% endblock %}
