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

{% block content %}
<div class="row">
    <div class="large-12 columns">
        <h2>{% trans 'Password change' %}</h2>

        <form action="" method="post">{% csrf_token %}
            {% if form.errors %}
            <div class="alert-box alert">
                {% if form.errors.items|length == 1 %}{% trans "Please correct the error below." %}{% else %}{% trans "Please correct the errors below." %}{% endif %}
            </div>
            {% endif %}

            <fieldset class="module aligned wide">

                <label {% if form.old_password.errors %}class="error"{% endif %}>{% trans 'Old password' %}
                    {{ form.old_password }}
                </label>
                {% if form.old_password.errors %}
                    <span class="error">{% for error in form.old_password.errors %}{{ error|escape }}{% endfor %}</span>
                {% endif %}

                <label {% if form.new_password1.errors %}class="error"{% endif %}>{% trans 'New password' %}
                    {{ form.new_password1 }}
                </label>
                {% if form.new_password1.errors %}
                    <span class="error">{% for error in form.new_password1.errors %}{{ error|escape }}{% endfor %}</span>
                {% endif %}
                
                <label {% if form.new_password2.errors %}class="error"{% endif %}>{% trans 'Password (again)' %}
                    {{ form.new_password2 }}
                </label>
                {% if form.new_password2.errors %}
                    <span class="error">{% for error in form.new_password2.errors %}{{ error|escape }}{% endfor %}</span>
                {% endif %}

            </fieldset>

            <input type="submit" value="{% trans 'Change my password' %}" class="button radius" />
        </form>
    </div>
</div>

<script type="text/javascript">document.getElementById("id_old_password").focus();</script>

{% endblock %}