2021-12-31 13:25:10 -05:00

77 lines
2.6 KiB
HTML

{% extends "account/base.html" %}
{% load i18n a17t_tags %}
{% block head_title %}{% trans "Email Addresses" %}{% endblock %}
{% block page_title %}{% trans "Email Addresses" %}{% endblock %}
{% block main %}
<div class="card max-w-lg">
{% if user.emailaddress_set.all %}
<p>{% trans 'These are your known email addresses:' %}</p>
<form action="{% url 'account_email' %}" class="email_list" method="post">
{% csrf_token %}
<fieldset class="blockLabels">
{% for emailaddress in user.emailaddress_set.all %}
<div class="ctrlHolder my-2">
<label for="email_radio_{{forloop.counter}}" class="switch">
<input id="email_radio_{{forloop.counter}}" type="radio" name="email"
{% if emailaddress.primary or user.emailaddress_set.count == 1 %}checked="checked" {%endif %}
value="{{emailaddress.email}}" />
{{ emailaddress.email }}
{% if emailaddress.verified %}
<span class="badge ~positive">{% trans "Verified" %}</span>
{% else %}
<span class="badge ~critical">{% trans "Unverified" %}</span>
{% endif %}
{% if emailaddress.primary %}<span class="badge ~urge">{% trans "Primary" %}</span>{% endif %}
</label>
</div>
{% endfor %}
<div class="block mt-4">
<button class="button ~neutral @high mb-1" type="submit" name="action_primary">{% trans 'Make Primary' %}</button>
<button class="button ~neutral mb-1" type="submit" name="action_send">{% trans 'Resend Verification' %}</button>
<button class="button ~neutral mb-1" type="submit" name="action_remove">{% trans 'Remove' %}</button>
</div>
</fieldset>
</form>
{% else %}
<aside class="aside ~warning">
<p>
{% trans "You currently do not have an email address associated with your account. Without one, you won't be able to reset your password, receive notifications, etc." %}
</p>
</aside>
{% endif %}
</div>
<hr class="sep">
<form method="post" action="{% url 'account_email' %}" class="card max-w-lg">
{% csrf_token %}
{{ form|a17t }}
<button name="action_add" class="button ~neutral @high" type="submit">{% trans "Add Address" %}</button>
</form>
{% endblock %}
{% block extra_body %}
<script type="text/javascript">
(function () {
var message = "{% trans 'Do you really want to remove the selected email address?' %}";
var actions = document.getElementsByName('action_remove');
if (actions.length) {
actions[0].addEventListener("click", function (e) {
if (!confirm(message)) {
e.preventDefault();
}
});
}
})();
</script>
{% endblock %}