{% extends "base.html" %}
{% load static %}
{% load i18n %}
{% load account allauth %}

{% block head_title %}
    {% trans "Confirm Email Address" %}
{% endblock head_title %}

{% block content %}
    <!-- Email Confirmation Start -->
    <section class="space-py-100">
        <div class="container">
            <div class="grid grid-cols-12">
                <div class="col-span-12">
                    <div class="codex-authbox">
                        <div class="auth-header">
                            <div class="codex-brand">
                                <a href="{% url 'main:home' %}">
                                    <img class="img-fluid light-logo" src="{% static 'main/assets/images/logo/logo.webp' %}" alt="logo">
                                    <img class="img-fluid dark-logo" src="{% static 'main/assets/images/logo/logo-light.webp' %}" alt="logo">
                                </a>
                            </div>
                            <h3>{% trans "Confirm Email Address" %}</h3>
                        </div>

                        {% if confirmation %}
                            {% user_display confirmation.email_address.user as user_display %}
                            {% if can_confirm %}
                                <p>
                                    {% blocktrans with confirmation.email_address.email as email %}
                                        Please confirm that <a href="mailto:{{ email }}">{{ email }}</a> is an email address for user {{ user_display }}.
                                    {% endblocktrans %}
                                </p>
                                {% url 'account_confirm_email' confirmation.key as action_url %}
                                <form method="post" action="{{ action_url }}">
                                    {% csrf_token %}
                                    {{ redirect_field }}
                                    <div class="group-form mb-0">
                                        <button type="submit" class="btn btn-primary">
                                            {% trans "Confirm" %}
                                        </button>
                                    </div>
                                </form>
                            {% else %}
                                <p>
                                    {% blocktrans %}
                                        Unable to confirm {{ email }} because it is already confirmed by a different account.
                                    {% endblocktrans %}
                                </p>
                            {% endif %}
                        {% else %}
                            {% url 'account_email' as email_url %}
                            <p>
                                {% blocktrans %}
                                    This email confirmation link expired or is invalid. Please <a href="{{ email_url }}">issue a new email confirmation request</a>.
                                {% endblocktrans %}
                            </p>
                        {% endif %}
                    </div>
                </div>
            </div>
        </div>
    </section>
    <!-- Email Confirmation End -->
{% endblock content %}

{% block extra_body %}
    {{ block.super }}
{% endblock extra_body %}
