2021-02-27 22:18:27 +00:00
{% extends 'account/base.html' %}
{% load i18n %}
{% block head_title %}{% trans "E-mail Addresses" %}{% endblock %}
{% block content %}
< div class = "row" >
< div class = "col-md-12" >
< div class = "panel panel-default" >
< div class = "panel-heading" >
< h4 > {% trans "E-mail Addresses" %}< / h4 >
< / div >
< div class = "panel-body" >
{% if user.emailaddress_set.all %}
< p > {% trans 'The following e-mail addresses are associated with your account:' %}< / p >
< form action = "{% url 'account_email' %}" class = "email_list"
method="post">
{% csrf_token %}
< fieldset class = "blockLabels" >
< table class = "table" >
< thead >
< tr >
< th > < / th >
< th > {% trans "Address" %}< / th >
< th > {% trans "Status" %}< / th >
< th > {% trans "Primary" %}< / th >
< / tr >
< / thead >
< tbody >
{% for emailaddress in user.emailaddress_set.all %}
< tr class = "ctrlHolder" >
< label for = "email_radio_{{ forloop.counter }}"
class="{% if emailaddress.primary %}primary_email{% endif %}">
< td >
< input
id="email_radio_{{ forloop.counter }}"
type="radio"
name="email"
value="{{ emailaddress.email }}"
{% if emailaddress.primary or user.emailaddress_set.count == 1 %}
checked="checked"
{% endif %}
/>
< / td >
< td >
{{ emailaddress.email }}
< / td >
< td >
{% if emailaddress.verified %}
< span class = "label label-success" > Verified< / span >
{% else %}
< span class = "label label-danger" > Unverified< / span >
{% endif %}
< / td >
< td >
{% if emailaddress.primary %}
< span class = "label label-primary" > Primary< / span > {% endif %}
< / td >
< / label >
< / tr >
{% endfor %}
< / tbody >
< / table >
< div class = "buttonHolder" >
< button class = "btn btn-success" type = "submit"
name="action_primary">Make Primary
< / button >
< button class = "btn btn-primary" type = "submit"
name="action_send">Re-send Verification
< / button >
< button class = "btn btn-danger" type = "submit"
name="action_remove">Remove
< / button >
< / div >
< / fieldset >
< / form >
{% else %}
< p >
< strong > {% trans 'Warning:' %}< / strong >
{% trans "You currently do not have any e-mail address set up. You should really add an e-mail address so you can receive notifications, reset your password, etc." %}
< / p >
{% endif %}
< / div >
< / div >
< div class = "panel panel-default" >
< div class = "panel-heading" >
< h4 > {% trans "Add E-mail Address" %}< / h4 >
< / div >
< div class = "panel-body" >
< form method = "post" action = "{% url 'account_email' %}"
class="add_email">
{% csrf_token %}
{{ form.as_p }}
< button name = "action_add" class = "btn btn-success" type = "submit" >
{% trans "Add E-mail" %}
< / button >
< / form >
< / div >
< / div >
< / div >
< / div >
< script type = "text/javascript" >
(function () {
let message = "{% trans 'Do you really want to remove the selected e-mail address?' %}";
let actions = document.getElementsByName('action_remove');
if (actions.length) {
actions[0].addEventListener("click", function (e) {
if (!confirm(message)) {
e.preventDefault();
}
});
}
})();
< / script >
2021-02-28 22:03:32 +00:00
{% endblock %}