{% extends "admin/base_site.html" %}
{% load i18n static django_admin_mazer %}
{% block extrastyle %}{{ block.super }}
    <link rel="stylesheet" type="text/css" href="{% static "admin/css/forms.css" %}">
    <style>
        form .aligned ul {
            margin-left: 0;
            padding-left: 0 !important;
        }

        form .aligned ul li:before {
            content: "\00270e";
            margin-right: 0.5rem;
        }
    </style>
{% endblock %}
{% block userlinks %}{% url 'django-admindocs-docroot' as docsroot %}{% if docsroot %}
    <a href="{{ docsroot }}">{% translate 'Documentation' %}</a> / {% endif %} {% translate 'Change password' %} /
    <a href="{% url 'admin:logout' %}">{% translate 'Log out' %}</a>{% endblock %}

{% block breadcrumbs %}
    <li class="breadcrumb-item"><a href="{% url 'admin:index' %}">{% translate 'Home' %}</a></li>
    <li class="breadcrumb-item active" aria-current="page">
        {% translate 'Password change' %}
    </li>
{% endblock %}

{% block content %}
    <p>{% translate 'Please enter your old password, for security’s sake, and then enter your new password twice so we can verify you typed it in correctly.' %}</p>
    <div id="content-main" class="card">
        <div class="card-body">
            <form method="post">{% csrf_token %}
                <div>
                    {% if form.errors %}
                        <p class="errornote text-danger">
                            {% if form.errors.items|length == 1 %}
                                {% translate "Please correct the error below." %}{% else %}
                                {% translate "Please correct the errors below." %}{% endif %}
                        </p>
                    {% endif %}



                    <fieldset class="module aligned wide">
                        <div class="form-group row">
                            <div class="col-md-3 col-3 ms-lg-3">
                                <label class="align-left fw-bold col-form-label"
                                       for="id_old_password">
                                    Old Password
                                </label>
                            </div>
                            <div class="col-lg-6 col-md-9 col-12">
                                <div class="row">
                                    {{ form.old_password|add_class:"form-control is-invalid" }}
                                </div>
                                <div class="help-block text-danger">
                                    {% if not line.fields|length_is:'1' and not field.is_readonly %}
                                        {{ form.old_password.errors }}{% endif %}
                                </div>
                                {% if form.old_password.help_text %}
                                    <p class="help-block"><small
                                            class="text-muted">{{ form.old_password.help_text }}</small></p>
                                {% endif %}
                                <div class="help-block text-danger flex-start">
                                    {% if line.fields|length_is:'1' %}{{ form.old_password.errors }}{% endif %}
                                </div>
                            </div>
                        </div>

                        <div class="form-group row">
                            <div class="col-md-3 col-3 ms-lg-3">
                                <label class="align-left fw-bold col-form-label"
                                       for="id_new_password1">
                                    New Password
                                </label>
                            </div>
                            <div class="col-lg-6 col-md-9 col-12">
                                <div class="row">
                                    {{ form.new_password1|add_class:"form-control is-invalid" }}
                                </div>
                                <div class="help-block text-danger">
                                    {% if not line.fields|length_is:'1' and not field.is_readonly %}
                                        {{ form.new_password1.errors }}{% endif %}
                                </div>
                                {% if form.new_password1.help_text %}
                                    <p class="help-block"><small
                                            class="text-muted">{{ form.new_password1.help_text }}</small></p>
                                {% endif %}
                                <div class="help-block text-danger flex-start">
                                    {% if line.fields|length_is:'1' %}{{ form.new_password1.errors }}{% endif %}
                                </div>
                            </div>
                        </div>

                        <div class="form-group row">
                            <div class="col-md-3 col-3 ms-lg-3">
                                <label class="align-left fw-bold col-form-label"
                                       for="id_new_password2">
                                    New Password Confirm
                                </label>
                            </div>
                            <div class="col-lg-6 col-md-9 col-12">
                                <div class="row">
                                    {{ form.new_password2|add_class:"form-control is-invalid" }}
                                </div>
                                <div class="help-block text-danger">
                                    {% if not line.fields|length_is:'1' and not field.is_readonly %}
                                        {{ form.new_password2.errors }}{% endif %}
                                </div>
                                {% if form.new_password2.help_text %}
                                    <p class="help-block"><small
                                            class="text-muted">{{ form.new_password2.help_text }}</small></p>
                                {% endif %}
                                <div class="help-block text-danger flex-start">
                                    {% if line.fields|length_is:'1' %}{{ form.new_password2.errors }}{% endif %}
                                </div>
                            </div>
                        </div>
                    </fieldset>

                    <div class="submit-row">
                        <input type="submit" value="{% translate 'Change my password' %}"
                               class=" btn btn-primary rounded-pill px-5">
                    </div>
                </div>
            </form>
        </div>
    </div>
{% endblock %}
