{% extends "admin/base_initial.html" %}
{% load i18n static admin_kubi_tags %}

{% block bodyclass %}{{ block.super }} password-reset auth{% endblock %}

{% block title %}{% translate "Password reset" %}{% endblock %}

{% block initial-content %}

  <form action="" method="post" class="w-100 m-auto" autocomplete="off" novalidate>
    {% csrf_token %}
    {% if validlink %}
      <h1 class="h3 mb-3 fw-normal">{% translate 'Enter new password' %}</h1>
      <p class="alert alert-warning">
        {% translate "Please enter your new password twice so we can verify you typed it in correctly." %}
      </p>

      <div class="form-floating">
        {% translate 'New password' as new_password1_label %}
        <input type="password"
                placeholder="{{ new_password1_label }}"
                class="form-control {% if form.new_password1.errors %}is-invalid{% endif %}"
                name="{{ form.new_password1.html_name }}"
                id="{{ form.new_password1.html_name }}"
                autocomplete="off"
                required>
        <label for="{{ form.new_password1.html_name }}">{{ new_password1_label }}</label>
        {{ form.new_password1.errors }}
      </div>

      <div class="form-floating">
        {% translate 'Confirm password' as new_password2_label %}
        <input type="password"
                placeholder="{{ new_password2_label }}"
                class="form-control {% if form.new_password2.errors %}is-invalid{% endif %}"
                name="{{ form.new_password2.html_name }}"
                id="{{ form.new_password2.html_name }}"
                autocomplete="off"
                required>
        <label for="{{ form.new_password2.html_name }}">{{ new_password2_label }}</label>
        {{ form.new_password2.errors }}
      </div>

      <button type="submit" class="w-100 btn btn-lg btn-primary mt-3">{% translate 'Change my password' %}</button>
    {% else %}
      <h1 class="h3 mb-3 fw-normal">{% translate 'Password reset unsuccessful' %}</h1>
      <p class="alert alert-danger">
        {% translate "The password reset link was invalid, possibly because it has already been used.  Please request a new password reset." %}
      </p>
    {% endif %}
  </form>

  {% url 'admin:index' as admin_url %}
  {% if admin_url %}
    <br/>
    <p>
      <a class="link-body-emphasis" href="{{ admin_url }}">
        {% translate 'Go back to the login page.' %}
      </a>
    </p>
  {% endif %}
{% endblock %}


