{% extends "outside_template/registration/base_login.html" %}
{% load i18n static %}

{#{% block breadcrumb %}#}
{#    <ol class="breadcrumb">#}
{#        <li class="breadcrumb-item">#}
{#            <a href="{% url 'core:index' %}">{% trans 'Home' %}</a>#}
{#        </li>#}
{#        <li class="breadcrumb-item">#}
{#            {% trans 'Password reset' %}#}
{#        </li>#}
{#    </ol>#}
{#{% endblock %}#}

{% block containerright %}
    <div class="container">
        <div class="row align-items-center">
            <div class="col align-self-center">
                <div>
                    {% if form.errors %}
                        <div class="alert alert-danger" role="alert">
                            {% trans 'Incorrect password' %}
                        </div>
                    {% endif %}
                    {% if next %}
                        {% if user.is_authenticated %}
                            <div class="alert alert-warning" role="alert">
                                {% trans "Your account doesn't have access." %}
                            </div>
                        {% else %}
                            <div class="alert alert-secondary" role="alert">
                                {% trans 'Please login to see this page.' %}
                            </div>
                        {% endif %}
                    {% endif %}
                    <form class="needs-validation was-validated" method="post" novalidate
                          action="{% url 'core:password_change' %}">
                        {% csrf_token %}
                        {#                    {{ form.as_p }}#}

                        {#                #}
                        {#                #}
                        <div class="form-row">
                            {% for hidden in form.hidden_fields %}
                                {{ hidden }}
                            {% endfor %}
                            {% for field in form.visible_fields %}
                                <div class="form-group col-12 ">
                                    {{ field.label_tag }}
                                    <input name="{{ field.html_name }}"
                                           id="{{ field.id_for_label }}"
                                           type="{{ field.field.widget.input_type }}"
                                            {% if field.field.max_length %}
                                           maxlength="{{ field.field.max_length }}"
                                            {% endif %}
                                           value="{% if field.data is not None %}{{ field.data }}{% endif %}"
                                            {% if field.field.required %} required {% endif %}
                                            class="form-control obrigatorio" placeholder="{{ field.label }}">
                                    {% if field.field.required %}
                                        <div class="invalid-feedback">
                                             {{ field.field.error_messages.required|default:"Campo Obrigatorio." }}
                                        </div>
                                    {% endif %}
                                    {% if field.field.help_text %}
                                        <small class="form-text text-muted">{{ field.field.help_text|safe }}</small>
                                    {% endif %}
                                    {% if field.errors %}
                                        {{ field.errors }}
                                    {% endif %}
                                </div>
                            {% endfor %}
                        </div>
                        <div class="form-group col-12 text-right">
                            <a href="{% url 'core:index' %}" class="btn btn-secondary" >{% trans 'Voltar Pagina Inicial' %}</a>

                            <input class="btn btn-primary" type="submit"
                                   value="{% trans 'Confirmar Alteração de Senha' %}"/>
                            <input type="hidden" name="next" value="{{ next }}"/>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
{% endblock %}