Skip to main content

max / makenotwork

2.6 KB · 57 lines History Blame Raw
1 {% extends "base.html" %}
2 {% block title %}Email preferences - Makenotwork{% endblock %}
3 {% block body_attrs %} class="{{ crate::shell::measure(crate::shell::Measure::Contained) }}"{% endblock %}
4 {% block content %}
5 {# Reached from a signed link in an email, with no session. Every form here
6 carries the same token the page did, because that token is the
7 authorisation: asking somebody to log in before they can stop receiving
8 email is how "unsubscribe" turns into "mark as spam".
9
10 GET renders. Nothing on this page mutates without a POST, so a mail client
11 or link scanner prefetching the URL cannot unsubscribe anyone. #}
12 <div class="email-result-wrap prefs-wrap">
13 <h1 class="brand-h1">Email preferences</h1>
14
15 {% if subscriptions.is_empty() %}
16 <p>This address is not subscribed to anything.</p>
17 {% else %}
18 <p>Choose what you hear about. Changes take effect immediately.</p>
19
20 <ul class="prefs-list">
21 {% for sub in subscriptions %}
22 <li class="prefs-row{% if sub.subscription_id == origin_subscription %} prefs-row--origin{% endif %}">
23 <span class="prefs-name">{{ sub.title }}</span>
24 {% if sub.required %}
25 {# Receipts, security and account mail. Listed so the page is an
26 honest inventory of what we send, with no toggle, because there
27 is no opting out of a receipt. #}
28 <span class="prefs-required">Always sent</span>
29 {% else %}
30 <form method="post" action="/unsubscribe/list" class="inline-form">
31 <input type="hidden" name="sub" value="{{ token }}">
32 <input type="hidden" name="sig" value="{{ signature }}">
33 <input type="hidden" name="target" value="{{ sub.subscription_id }}">
34 {% if sub.subscribed() %}
35 <input type="hidden" name="action" value="unsubscribe">
36 <button type="submit" class="btn-secondary">Unsubscribe</button>
37 {% else %}
38 <input type="hidden" name="action" value="resubscribe">
39 <button type="submit" class="btn-secondary">Resubscribe</button>
40 {% endif %}
41 </form>
42 {% endif %}
43 </li>
44 {% endfor %}
45 </ul>
46
47 <form method="post" action="/unsubscribe/all" class="prefs-all">
48 <input type="hidden" name="sub" value="{{ token }}">
49 <input type="hidden" name="sig" value="{{ signature }}">
50 <button type="submit" class="btn-primary">Unsubscribe from everything</button>
51 </form>
52 {% endif %}
53
54 <p><a href="/">Back to Makenotwork</a></p>
55 </div>
56 {% endblock %}
57