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

{% load account %}
{% load i18n %}

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

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

      <div class="ui tall stacked segment">
        {% if user.is_authenticated %}
          <div class="ui message red">
            {% include "account/snippets/already_logged_in.html" %}
          </div>
          <p><a href="/">{% trans 'Go back to the homepage' %}</a></p>
        {% else %}
          <p>{% trans "Have you forgotten your password? Enter your e-mail address below, and we'll send you an e-mail allowing you to reset it." %}</p>

          <form method="POST" action="{% url 'account_reset_password' %}" class="ui form">
            {% csrf_token %}
            <div class="field {% if form.errors.email %}error{% endif %}">
              {{ form.email.label_tag }}
              {{ form.email }}

              {% if form.errors.email %}
                <div class="ui pointing red basic label">
                  {% for error in form.errors.email %}
                    <p>{{ error }}</p>
                  {% endfor %}
                </div>
              {% endif %}
            </div>
            <button type="submit" class="ui button primary">{% trans 'Reset My Password' %}</button>
          </form>
          <hr />
          <p class="text-center">{% blocktrans %}Please contact us if you have any trouble resetting your password.{% endblocktrans %}</p>
        {% endif %}
      </div>


    </div>
  </div>
{% endblock %}
