{% extends "layouts/base.html" %}
{% load i18n static %}

{% block extrastyle %}
    {{ block.super }}
    <link rel="stylesheet" type="text/css" href="{% static "admin/css/forms.css" %}">
{% endblock %}

{% block breadcrumbs %}
    <div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center py-4">
        <div class="d-block mb-4 mb-md-0">
            <nav aria-label="breadcrumb" class="d-none d-md-inline-block">
                <ol class="breadcrumb breadcrumb-dark breadcrumb-transparent">
                    <li class="breadcrumb-item">
                        <a href="{% url 'admin:index' %}">
                            <svg class="icon icon-xxs" fill="none" stroke="currentColor" viewBox="0 0 24 24"
                                 xmlns="http://www.w3.org/2000/svg">
                                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
                                      d="M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6"></path>
                            </svg>
                        </a>
                    </li>
                    <li class="breadcrumb-item">{% trans 'Password change' %}</li>
                </ol>
            </nav>
        </div>
    </div>
{% endblock %}

{% block title %}{{ title }}{% endblock %}

{% block content %}
    <div class="row">
        <div class="col-md-12">
            <div class="card">
                <div class="card-header">
                    <div class="title">
                        {% trans "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." %}
                    </div>
                </div>
                <div class="card-body">
                    <form method="post">
                        {% csrf_token %}

                        <div class="form-group">
                            {{ form.old_password.errors }}
                            {{ form.old_password.label_tag }} {{ form.old_password }}
                        </div>

                        <div class="form-group">
                            {{ form.new_password1.errors }}
                            {{ form.new_password1.label_tag }} {{ form.new_password1 }}
                            {% if form.new_password1.help_text %}
                                <div class="help">{{ form.new_password1.help_text|safe }}</div>
                            {% endif %}
                        </div>

                        <div class="form-group">
                            {{ form.new_password2.errors }}
                            {{ form.new_password2.label_tag }} {{ form.new_password2 }}
                            {% if form.new_password2.help_text %}
                                <div class="help">{{ form.new_password2.help_text|safe }}</div>
                            {% endif %}
                        </div>

                        <div class="card submit_btn">
                            <div class="card-body">
                                <button type="submit" class="btn btn-sm btn-primary">
                                    {% trans 'Change my password' %}
                                </button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
{% endblock %}

{% block extrascript %}
    <script type="application/javascript">
        {% if form.errors %}
            notification.danger("{% trans "Please correct the errors below." %}", 'top', 'right');
        {% endif %}
    </script>
{% endblock %}
