{% extends "base.html" %}

{% block head_title %}Email Confirmation Test{% endblock %}

{% block body_content %}
{% if user.is_authenticated %}
{% if messages %}
<ul>
    {% for message in messages %}
    <li>{{ message }}</li>
    {% endfor %}
</ul>
{% endif %}
<p>Logged in as {{ user }}.</p>
<ul>
    <li><a href="/logout/">logout</a></li>
</ul>
<p>Your email addresses:</p>
<ul>
{% for emailaddress in user.emailaddress_set.all %}
    <li>{{ emailaddress.email }}
        {% if emailaddress.verified %}
        <span class="verified">verified</span>
        {% else %}
        <span class="unverified">unverified</span>
        <form method="post" action="">
            <input type="hidden" name="email" value="{{ emailaddress.email }}"/>
            <input type="submit" name="action" value="send"/> another confirmation email
        </form>
        {% endif %}
    </li>
{% endfor %}
</ul>
<form method="post" action="">
<table>{{ add_email_form.as_table }}</table>
<input type="submit" name="action" value="add"/>
</form>

{% else %}
<p>Not logged in.</p>
<ul>
    <li><a href="/signup/">signup</a></li>
    <li><a href="/login/">login</a></li>
</ul>
{% endif %}
{% endblock %}