{% extends "base.html" %}
{% block title %}Change Password{% endblock %}

{% block content_header %}
<div class="content-header">
    <div class="container-fluid">
      <div class="row mb-2">
        <div class="col-sm-6">
          <h1 class="m-0">Change Password</h1>
        </div>
        <div class="col-sm-6">
          <ol class="breadcrumb float-sm-right">
            <li class="breadcrumb-item"><a href="#">Home</a></li>
            <li class="breadcrumb-item active">Change Password</li>
          </ol>
        </div>
      </div>
    </div>
</div>
{% endblock %}

{% block content %}
<div class="row">
    <div class="col-lg-6">
        <div class="card">
            <div class="card-body">
              <h5 class="card-title">Change password for {{ user.username }}</h5>
              <p class="card-text">
                <form method="post">{% csrf_token %}
                    {% if form.errors %}
                        <p class="errornote">
                        {% if form.errors.items|length == 1 %}Please correct the error below.{% else %}Please correct the errors below.{% endif %}
                        </p>
                    {% endif %}
                    <div class="form-group">
                        {{ form.old_password.label_tag }} 
                        <input name="old_password" type="password" class="form-control {% if form.old_password.errors %}is-invalid{% endif %}" placeholder="Old Password">
                        {{ form.old_password.errors }}
                    </div>
                    <div class="form-group">
                        {{ form.new_password1.label_tag }}
                        <input name="new_password1" type="password" class="form-control {% if form.new_password1.errors %}is-invalid{% endif %}" placeholder="New Password">
                        {{ form.new_password1.errors }}
                    </div>
                    <div class="form-group">
                        {{ form.new_password2.label_tag }} 
                        <input name="new_password2" type="password" class="form-control {% if form.new_password2.errors %}is-invalid{% endif %}" placeholder="Confirm Password">
                        {{ form.new_password2.errors }}
                    </div>
                    <div class="form-group">
                        <button type="submit" class="btn btn-primary btn-block">Change my password</button>
                    </div>
                </form>
              </p>
            </div>
        </div>
    </div>
</div>
{% endblock %}