{% extends "admin/base_site.html" %}
{% load i18n %}

{% block bodyclass %}{{ block.super }} passwordform-page{% endblock %}


{% block breadcrumb_items %}
  <li class="breadcrumb-item active" aria-current="page">
    {% trans 'Password change' %}
  </li>
{% endblock breadcrumb_items %}


{% block message_items %}
  {{ block.super }}

  {% if form.errors %}
    <li class="list-group-item list-group-item-danger">
      {% if form.errors|length == 1 %}
        {% trans "Please correct the error below." %}
      {% else %}
        {% trans "Please correct the errors below." %}
      {% endif %}
    </li>

    {% for error in form.non_field_errors %}
      <li class="list-group-item list-group-item-danger">
        {{ error }}
      </li>
    {% endfor %}
  {% endif %}
{% endblock %}


{% block before_content %}
  <h1 class="paper-title">
    {% trans 'Password change' %}
  </h1>
{% endblock %}


{% block content %}
  <form id="passwordform" method="post" action="{{ form_url }}" novalidate>
    {% csrf_token %}

    {% block form_top %}{% endblock %}

    {% if is_popup %}
      <input type="hidden" name="{{ is_popup_var }}" value="1" />
    {% endif %}

    <input type="hidden" name="username" value="{{ original.get_username }}"/>

    <fieldset class="paper-form-card card card-info">
      <div class="card-header">
        <small class="card-subtitle">
          {% 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." %}
        </small>
      </div>
      <div class="card-body">
        {% include 'paper_admin/includes/admin_field.html' with field=form.old_password %}
        {% include 'paper_admin/includes/admin_field.html' with field=form.new_password1 %}
        {% include 'paper_admin/includes/admin_field.html' with field=form.new_password2 %}
      </div>
    </fieldset>

    <button type="submit" class="btn btn-success">
      {% trans 'Change my password' %}
    </button>
  </form>
{% endblock %}
