{% extends "account/base.html" %}

{% load i18n %}
{% block head_title %}{% trans "Change Password" %}{% endblock %}

{% block content %}
    <h1>{% if token_fail %}{% trans "Bad Token" %}{% else %}{% trans "Change Password" %}{% endif %}</h1>

    {% if token_fail %}
        {% url 'account_reset_password' as passwd_reset_url %}
        <p>{% blocktrans %}The password reset link was invalid, possibly because it has already been used.  Please request a <a href="{{ passwd_reset_url }}">new password reset</a>.{% endblocktrans %}</p>
    {% else %}
        {% if form %}
            <form method="POST" action="{{ action_url }}">
                {% csrf_token %}
                {% if form.non_field_errors %}
                <div class="p-2 my-4">
                  {{ form.non_field_errors }}
                </div>
              {% endif %}
              <div class="form-group">
                <label for="password1">{% trans "New Password (again)" %}</label>
                <input type="password" class="form-control" name="password1" id="password1" {% if form.password1.value != None %}value="{{ form.password1.value }}"{% endif %} required placeholder="{% trans 'New Passowrd' %}">
                {{ form.login.errors }}
              </div>
              <div class="form-group">
                <label for="password2">{% trans "New Password" %}</label>
                <input type="password" class="form-control" name="password2" id="password2" {% if form.password2.value != None %}value="{{ form.password2.value }}"{% endif %} required placeholder="{% trans 'New Passowrd (again)' %}">
                {{ form.login.errors }}
              </div>
                <input class="btn btn-primary" type="submit" name="action" value="{% trans 'change password' %}"/>
            </form>
        {% else %}
            <p>{% trans 'Your password is now changed.' %}</p>
        {% endif %}
    {% endif %}
{% endblock %}
