{% extends "base.html" %}
{% block title %}{{ "Email confirmed" if ok else "That link did not work" }}{% endblock %}
{% block chrome %}{% endblock %}
{% block content %}
<div class="card">
{% if ok %}
<h1>Email confirmed</h1>
{% if awaiting_approval %}
{# Verified is not admitted. Saying which gate just opened and which has not
is what stops the wait that follows from looking like a dead end. #}
<p>Thanks - we know the address is yours.</p>
<p>Your account still needs to be approved before you can sign in. We'll email
you as soon as that happens; there is nothing else for you to do.</p>
{% else %}
<p>Thanks - your address is confirmed.</p>
<p><a class="button-secondary" href="/login">Sign in</a></p>
{% endif %}
{% else %}
<h1>That link did not work</h1>
<p class="error">{{ message }}</p>
{# One message for spent, expired and never-existed alike - see
auth.verify_email. A fresh link is one form away, which is the only useful
thing to offer here. #}
<p>Confirmation links are single-use and expire after a day. Ask for another:</p>
<form id="resend-form">
<label>Email
<input type="email" name="email" autocomplete="username" required autofocus>
</label>
<button type="submit">Send a new link</button>
</form>
<p class="note" id="resent" hidden>
If that address has an unconfirmed account, a new link is on its way.
</p>
{% endif %}
</div>
{% endblock %}
{% block scripts %}
{% if not ok %}
<script>
const form = document.getElementById("resend-form");
form.addEventListener("submit", async (e) => {
e.preventDefault();
await api.post("/api/signup/resend", { email: new FormData(form).get("email") });
form.hidden = true;
document.getElementById("resent").hidden = false;
});
</script>
{% endif %}
{% endblock %}