{% extends "dictionary/base.html" %}
{% load widget_tweaks i18n %}
{% block title %}{% trans "password reset" context "titleblock" %}{% endblock %}
{% block content %}
    <h1 class="h4 mb-3"><strong>{% trans "password reset" context "titleblock" %}</strong></h1>

    {% if form %}
        <form method="post">
            {% csrf_token %}

            <div class="form-group">
                {% for err in form.non_field_errors %}
                    <div class="alert-danger p-3 mb-3 rounded">{{ err }}</div>
                {% endfor %}

                <div class="form-group">
                    <label class="mr-2" for="pref_new_password1"><strong>{{ form.new_password1.label }}</strong></label>
                    {% render_field form.new_password1 class="form-control" id="pref_new_password1" %}

                    {% if form.new_password1.errors %}
                        <ul class="list-unstyled">
                            {% for error in form.new_password1.errors %}
                                <li class="text-danger">{{ error }}</li>
                            {% endfor %}
                        </ul>
                    {% endif %}
                    <small class="text-muted password-help">{{ form.new_password1.help_text }}</small>
                </div>

                <div class="form-group">
                    <label class="mr-2" for="pref_new_password2"><strong>{{ form.new_password2.label }}</strong></label>
                    {% render_field form.new_password2 class="form-control" id="pref_new_password2" %}

                    {% if form.new_password2.errors %}
                        <ul class="list-unstyled">
                            {% for error in form.new_password2.errors %}
                                <li class="text-danger">{{ error }}</li>
                            {% endfor %}
                        </ul>
                    {% endif %}
                </div>
            </div>

            <button type="submit" class="btn btn-django stretch">{% trans "hopefully i won't forget it again" %}</button>
        </form>
    {% else %}
        {% url "password_reset" as password_reset_url %}
        <div class="bg-light p-3 mb-3 rounded" role="alert">
            {% blocktrans trimmed %}
                hello dear, we couldn't really understand you. if you want to reset your password visit
                <a href="{{ password_reset_url }}">this page</a>.
            {% endblocktrans %}
        </div>
    {% endif %}
{% endblock %}
