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

{% load i18n material_form %}

{% block browser_title %}{% trans "Change password" %}{% endblock %}
{% block no_page_title %}{% endblock %}

{% block content %}
  {% if token_fail %}
    <div class="container">
      <div class="card red">
        <div class="card-content white-text">
          <div class="card-title">
            <i class="material-icons iconify small left" data-icon="mdi:alert-octagon-outline"></i>
            {% blocktrans %}Bad token{% endblocktrans %}
          </div>
          <p>
            {% url 'account_reset_password' as passwd_reset_url %}
            {% blocktrans %}
              The password reset link was invalid, possibly because it has already been used. Please request a <a href="{{ passwd_reset_url }}"
              class="blue-text text-lighten-2">new password reset</a>.
            {% endblocktrans %}
          </p>
          <p>
            {% blocktrans %}
              If this issue persists, please contact one of your site
              administrators
            {% endblocktrans %}
          </p>
          {% include "core/partials/admins_list.html" %}
        </div>
      </div>
    </div>
  {% else  %}
  <div class="row">
    <div class="col m1 l2 xl3"></div>
    <div class="col s12 m10 l8 xl6">
      <div class="card">
        {% if form %}
          <form method="post" action="{{ action_url }}">
            <div class="card-content">
              <div class="card-title">{% trans "Change password" %}</div>
                {% csrf_token %}
                {% form form=form %}{% endform %}
              <div class="card-action-light">
                {% trans "Change password" as caption %}
                {% include "core/partials/save_button.html" with caption=caption icon="mdi:exclamation" %}
              </div>
            </div>
          </form>
        {% else %}
      </div>
      <div class="alert success">
        <p>
          <i class="material-icons iconify left" data-icon="mdi:check"></i>
          {% blocktrans %}
            Your password is now changed!
          {% endblocktrans %}
        </p>
        <div class="card-action">
          <a href="{% url "login" %}">{% trans "Back to login" %}</a>
        </div>
      </div>
    {% endif %}
  {% endif %}

{% endblock %}
