{% extends "base.html" %}
{% load static %}
{% block title %}
Reset you Password
{% endblock title %}
{% block content %}
<div class="flex justify-center h-screen w-100 place-items-center bg-gradient">
  <div class="p-8 mx-4 space-y-3 shadow-lg bg-background rounded-4 w-100" style="max-width:30rem">
    {% if app.app_logo %}
    <div class="mb-5 text-center">
      <img src="{{ app.app_logo }}" alt="{{ app.app_info }} Logo" style="height:3.25rem"/>
    </div>
    {% endif %}
    {% if success %}
    <h1 class="text-3xl font-bold tracking-tight text-center text-black">Successfully Reset!</h1>
    <p class="font-medium leading-normal text-center text-gray-500 text-md">Your password has been changed. Use your new
      password to sign in.</p>
    {% elif fatal_error %}
    <h1 class="text-3xl font-bold tracking-tight text-center text-black">Something went wrong!</h1>
    <p class="font-medium leading-normal text-center text-gray-500 text-md">{{ fatal_error }}</p>
    <a href="{% url 'forgot_password' %}" class="btn btn-primary w-full mt-6">Request new Link</a>
    {% endif %}
    {% if parse %}
    <h1 class="text-3xl font-bold tracking-tight text-center text-black">Reset your Password</h1>
    <p class="font-medium leading-normal text-center text-gray-500 text-md">Enter your new password below to reset.</p>
    {% if error %}
    <div class="bg-danger bg-opacity-10 my-4 p-3.5 rounded-2 text-gray-900">
      <h2 class="mb-1 font-semibold">Error resetting</h2>
      <p class="text-md">{{ error }}</p>
    </div>
    {% endif %}
    {% if form %}
    <form method="post" class="mt-8 space-y-3 login-form">
      {% csrf_token %}
      <input type="hidden" name="token" value="{{ form.token.value }}">
      <div class="space-y-1">
        {{ form.password.label_tag }}
        {{ form.password }}
      </div>
      <div class="space-y-1">
        {{ form.confirm_password.label_tag }}
        {{ form.confirm_password }}
      </div>
      <button type="submit" class="w-full mt-5 btn-primary">
        Reset Password
      </button>
    </form>
    {% endif %}
    {% endif %}
    <a href="{% url 'login' %}" class="btn w-full mt-6">← Back to Sign In</a>
  </div>
</div>
{% endblock content %}
