{% extends "base.html" %}
{% load crispy_forms_filters %}

{% load i18n %}
{% load account %}

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

{% block content %}

    <div class="row">
        <div class="col-12" style="text-align: center">
            <h3>{% if token_fail %}{% trans "Bad Token" %}{% else %}{% trans "Change Password" %}{% endif %}</h3>
            {% if user.is_authenticated %}
                {% include "account/snippets/already_logged_in.html" %}
            {% endif %}
        </div>
    </div>

    <div class="row">
        <div class="col-sm-12 col-lg-6 col-md-6 offset-lg-3 offset-md-3">
            <hr>
            {% 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 %}
                        {{ form | crispy }}
                        <input type="submit" class="btn btn-warning float-right" name="action"
                               value="{% trans 'change password' %}"/>
                    </form>
                {% else %}
                    <p>{% trans 'Your password is now changed.' %}</p>
                {% endif %}
            {% endif %}
        </div>
    </div>
{% endblock %}

