email.html 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. {% extends "account/base.html" %}
  2. {% load i18n %}
  3. {% block head_title %}{% trans "E-mail Addresses" %}{% endblock %}
  4. {% block content %}
  5. <h1>{% trans "E-mail Addresses" %}</h1>
  6. {% if user.emailaddress_set.all %}
  7. <p>{% trans 'The following e-mail addresses are associated with your account:' %}</p>
  8. <form action="{% url 'account_email' %}" class="email_list" method="post">
  9. {% csrf_token %}
  10. <fieldset class="blockLabels">
  11. {% for emailaddress in user.emailaddress_set.all %}
  12. <div class="ctrlHolder">
  13. <label for="email_radio_{{forloop.counter}}" class="{% if emailaddress.primary %}primary_email{%endif%}">
  14. <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}}"/>
  15. {{ emailaddress.email }}
  16. {% if emailaddress.verified %}
  17. <span class="verified">{% trans "Verified" %}</span>
  18. {% else %}
  19. <span class="unverified">{% trans "Unverified" %}</span>
  20. {% endif %}
  21. {% if emailaddress.primary %}<span class="primary">{% trans "Primary" %}</span>{% endif %}
  22. </label>
  23. </div>
  24. {% endfor %}
  25. <div class="buttonHolder">
  26. <button class="secondaryAction" type="submit" name="action_primary" >{% trans 'Make Primary' %}</button>
  27. <button class="secondaryAction" type="submit" name="action_send" >{% trans 'Re-send Verification' %}</button>
  28. <button class="primaryAction" type="submit" name="action_remove" >{% trans 'Remove' %}</button>
  29. </div>
  30. </fieldset>
  31. </form>
  32. {% else %}
  33. <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>
  34. {% endif %}
  35. {% if can_add_email %}
  36. <h2>{% trans "Add E-mail Address" %}</h2>
  37. <form method="post" action="{% url 'account_email' %}" class="add_email">
  38. {% csrf_token %}
  39. {{ form.as_p }}
  40. <button name="action_add" type="submit">{% trans "Add E-mail" %}</button>
  41. </form>
  42. {% endif %}
  43. {% endblock %}
  44. {% block extra_body %}
  45. <script type="text/javascript">
  46. (function() {
  47. var message = "{% trans 'Do you really want to remove the selected e-mail address?' %}";
  48. var actions = document.getElementsByName('action_remove');
  49. if (actions.length) {
  50. actions[0].addEventListener("click", function(e) {
  51. if (! confirm(message)) {
  52. e.preventDefault();
  53. }
  54. });
  55. }
  56. })();
  57. </script>
  58. {% endblock %}