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

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

{% block head_title %}{% trans "Password Reset" %}{% endblock %}

{% block non_login_content %}

    <h1 class="h3 mb-3 fw-normal">{% trans "Password Reset" %}</h1>

    {% if user.is_authenticated %}
    {% include "account/snippets/already_logged_in.html" %}
    {% endif %}

    <p>{% trans "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="password_reset">
        {% csrf_token %}
        <label for="id_email" class="visually-hidden">
            {% trans "E-mail address" %}
        </label>
        <input type="email"
               id="id_email"
               name="email"
               class="form-control mb-lg-2 {% if form.email.errors %}is-invalid{% elif form.is_bound %}is-valid{% endif %}"
               placeholder="{% trans "E-mail address" %}"
               required>
        {% if form.email.errors %}
            {% for error in form.email.errors %}
                <div class="invalid-feedback mb-lg-2">
                    {{ error }}
                </div>
            {% endfor %}
        {% endif %}

        <input class="w-100 btn btn-lg btn-primary"
               type="submit" value="{% trans 'Reset My Password' %}" />
    </form>

    <p>{% blocktrans %}Please contact us if you have any trouble resetting your password.{% endblocktrans %}</p>

    <hr>
    <a class="w-100"
       type="submit"
       href="{% url "account_login" %}">
        {% trans "To login" %}
    </a>
{% endblock %}
