{% extends "base.html" %} {% load i18n %} {% load account %} {% load crispy_forms_tags %} {% block title %}{% translate "Email Addresses" %}{% endblock %} {% block content %}

{% translate "Account Settings" %}

{% translate "Manage your personal details and security." %}

{# ------------------- LEFT COLUMN: ACCOUNT MENU ------------------- #}
{# Assuming a main 'Profile' or 'Personal Information' page exists #} {# NOTE: You will need to replace 'user_detail' with your actual profile URL name #} {% translate "Personal Information" %} {# Highlight the current page (Email) as active #} {% translate "Email Addresses" %} {% translate "Change Password" %} {% translate "Sign Out" %}
{# ------------------- RIGHT COLUMN: EMAIL MANAGEMENT ------------------- #}
{% translate "Email Addresses" %}

{% translate "These email addresses are linked to your account. You can set the primary address, resend verification, or remove an address." %}

{# Django Messages for Success/Error feedback #} {% if messages %} {% for message in messages %} {% endfor %} {% endif %} {% if emailaddresses %} {% for emailaddress in emailaddresses %}

{{ emailaddress.email }} {# Status Badges #} {% if emailaddress.primary %} {% translate "Primary" %} {% endif %} {% if emailaddress.verified %} {% translate "Verified" %} {% else %} {% translate "Unverified" %} {% endif %}

{# 1. MAKE PRIMARY ACTION (Uses 'action_primary') #} {% if not emailaddress.primary %}
{% csrf_token %}
{% endif %} {# 2. RESEND VERIFICATION ACTION (Uses 'action_send') #} {% if not emailaddress.verified %}
{% csrf_token %}
{% endif %} {# 3. REMOVE ACTION (Uses 'action_remove') #} {% if not emailaddress.primary %}
{% csrf_token %}
{% endif %}
{% endfor %} {% else %}

{% translate "No email addresses found." %}

{% endif %}
{# ------------------- ADD EMAIL FORM (The form that failed previously) ------------------- #} {% if can_add_email %}
{% translate "Add Email Address" %}
{% csrf_token %} {# Ensure non-field errors are displayed (e.g., "Email already registered") #} {% if form.non_field_errors %} {% endif %} {# Crispy renders the form fields (including new_email) #} {{ form|crispy }} {# The button name is crucial for the allauth view to recognize the "Add" action #}
{% endif %}
{% endblock content %}