From 41f19b6643b44768dc06561c992c04ed6148477d Mon Sep 17 00:00:00 2001 From: Jeremy Kerr Date: Wed, 11 Aug 2010 14:16:28 +0800 Subject: Add email opt-out system We're going to start generating emails on patchwork updates, so firstly allow people to opt-out of all patchwork communications. We do this with a 'mail settings' interface, allowing non-registered users to set preferences on their email address. Logged-in users can do this through the user profile view. Signed-off-by: Jeremy Kerr --- templates/base.html | 2 ++ templates/patchwork/mail-form.html | 38 ++++++++++++++++++++++++ templates/patchwork/mail-settings.html | 37 ++++++++++++++++++++++++ templates/patchwork/optin-request.html | 50 ++++++++++++++++++++++++++++++++ templates/patchwork/optin-request.mail | 12 ++++++++ templates/patchwork/optin.html | 19 ++++++++++++ templates/patchwork/optout-request.html | 51 +++++++++++++++++++++++++++++++++ templates/patchwork/optout-request.mail | 12 ++++++++ templates/patchwork/optout.html | 22 ++++++++++++++ templates/patchwork/profile.html | 36 ++++++++++++++++------- 10 files changed, 269 insertions(+), 10 deletions(-) create mode 100644 templates/patchwork/mail-form.html create mode 100644 templates/patchwork/mail-settings.html create mode 100644 templates/patchwork/optin-request.html create mode 100644 templates/patchwork/optin-request.mail create mode 100644 templates/patchwork/optin.html create mode 100644 templates/patchwork/optout-request.html create mode 100644 templates/patchwork/optout-request.mail create mode 100644 templates/patchwork/optout.html (limited to 'templates') diff --git a/templates/base.html b/templates/base.html index 9e80dca..d3b8e67 100644 --- a/templates/base.html +++ b/templates/base.html @@ -31,6 +31,8 @@ login
register +
+ mail settings {% endif %}
diff --git a/templates/patchwork/mail-form.html b/templates/patchwork/mail-form.html new file mode 100644 index 0000000..d71b2fb --- /dev/null +++ b/templates/patchwork/mail-form.html @@ -0,0 +1,38 @@ +{% extends "base.html" %} + +{% block title %}mail settings{% endblock %} +{% block heading %}mail settings{% endblock %} + +{% block body %} + +

You can configure patchwork to send you mail on certain events, +or block automated mail altogether. Enter your email address to +view or change your email settings.

+ +
+{% csrf_token %} + +{% if form.errors %} + + + +{% endif %} + + + + + + + +
+ There was an error accessing your mail settings: +
{{ form.email.label_tag }} + {{form.email}} + {{form.email.errors}} +
+ +
+
+ + +{% endblock %} diff --git a/templates/patchwork/mail-settings.html b/templates/patchwork/mail-settings.html new file mode 100644 index 0000000..303139a --- /dev/null +++ b/templates/patchwork/mail-settings.html @@ -0,0 +1,37 @@ +{% extends "base.html" %} + +{% block title %}mail settings{% endblock %} +{% block heading %}mail settings{% endblock %} + +{% block body %} +

Settings for {{email}}:

+ + + + +{% if is_optout %} + + + +{% else %} + + +{% endif %} + +
Opt-out listPatchwork may not send automated notifications to + this address. +
+ {% csrf_token %} + + +
+
Patchwork may send automated notifications to + this address. +
+ {% csrf_token %} + + +
+
+ +{% endblock %} diff --git a/templates/patchwork/optin-request.html b/templates/patchwork/optin-request.html new file mode 100644 index 0000000..63a4e12 --- /dev/null +++ b/templates/patchwork/optin-request.html @@ -0,0 +1,50 @@ +{% extends "base.html" %} + +{% block title %}opt-in{% endblock %} +{% block heading %}opt-in{% endblock %} + +{% block body %} +{% if email_sent %} +

Opt-in confirmation email sent

+

An opt-in confirmation mail has been sent to +{{confirmation.email}}, containing a link. Please click on +that link to confirm your opt-in.

+{% else %} +{% if error %} +

{{error}}

+{% endif %} + +{% if form %} +

This form allows you to opt-in to automated email from patchwork. Use +this if you have previously opted-out of patchwork mail, but now want to +received notifications from patchwork.

+When you submit it, an email will be sent to your address with a link to click +to finalise the opt-in. Patchwork does this to prevent someone opting you in +without your consent.

+
+{% csrf_token %} +{{form.email.errors}} +
+{{form.email.label_tag}}: {{form.email}} +
+ +
+{% endif %} + +{% if error and admins %} +

If you are having trouble opting in, please email +{% for admin in admins %} +{% if admins|length > 1 and forloop.last %} or {% endif %} +{{admin.0}} <{{admin.1}}>{% if admins|length > 2 and not forloop.last %}, {% endif %} +{% endfor %} +{% endif %} + +{% endif %} + +{% if user.is_authenticated %} +

Return to your user +profile.

+{% endif %} + +{% endblock %} diff --git a/templates/patchwork/optin-request.mail b/templates/patchwork/optin-request.mail new file mode 100644 index 0000000..34dd2c7 --- /dev/null +++ b/templates/patchwork/optin-request.mail @@ -0,0 +1,12 @@ +Hi, + +This email is to confirm that you would like to opt-in to automated +email from the patchwork system at {{site.domain}}. + +To complete the opt-in process, visit: + + http://{{site.domain}}{% url patchwork.views.confirm key=confirmation.key %} + +If you didn't request this opt-in, you don't need to do anything. + +Happy patchworking. diff --git a/templates/patchwork/optin.html b/templates/patchwork/optin.html new file mode 100644 index 0000000..f7c0c04 --- /dev/null +++ b/templates/patchwork/optin.html @@ -0,0 +1,19 @@ +{% extends "base.html" %} + +{% block title %}opt-in{% endblock %} +{% block heading %}opt-in{% endblock %} + +{% block body %} + +

Opt-in complete. You have sucessfully opted back in to +automated email from this patchwork system, using the address +{{email}}.

+

If you later decide that you no longer want to receive automated mail from +patchwork, just visit http://{{site.domain}}{% url patchwork.views.mail.settings %}, or +visit the main patchwork page and navigate from there.

+{% if user.is_authenticated %} +

Return to your user +profile.

+{% endif %} +{% endblock %} diff --git a/templates/patchwork/optout-request.html b/templates/patchwork/optout-request.html new file mode 100644 index 0000000..dbdf250 --- /dev/null +++ b/templates/patchwork/optout-request.html @@ -0,0 +1,51 @@ +{% extends "base.html" %} + +{% block title %}opt-out{% endblock %} +{% block heading %}opt-out{% endblock %} + +{% block body %} +{% if email_sent %} +

Opt-out confirmation email sent

+

An opt-out confirmation mail has been sent to +{{confirmation.email}}, containing a link. Please click on +that link to confirm your opt-out.

+{% else %} +{% if error %} +

{{error}}

+{% endif %} + +{% if form %} +

This form allows you to opt-out of automated email from patchwork.

+

If you opt-out of email, Patchwork may still email you if you do certain +actions yourself (such as create a new patchwork account), but will not send +you unsolicited email.

+When you submit it, one email will be sent to your address with a link to click +to finalise the opt-out. Patchwork does this to prevent someone opting you out +without your consent.

+
+{% csrf_token %} +{{form.email.errors}} +
+{{form.email.label_tag}}: {{form.email}} +
+ +
+{% endif %} + +{% if error and admins %} +

If you are having trouble opting out, please email +{% for admin in admins %} +{% if admins|length > 1 and forloop.last %} or {% endif %} +{{admin.0}} <{{admin.1}}>{% if admins|length > 2 and not forloop.last %}, {% endif %} +{% endfor %} +{% endif %} + +{% endif %} + +{% if user.is_authenticated %} +

Return to your user +profile.

+{% endif %} + +{% endblock %} diff --git a/templates/patchwork/optout-request.mail b/templates/patchwork/optout-request.mail new file mode 100644 index 0000000..f896e3c --- /dev/null +++ b/templates/patchwork/optout-request.mail @@ -0,0 +1,12 @@ +Hi, + +This email is to confirm that you would like to opt-out from all email +from the patchwork system at {{site.domain}}. + +To complete the opt-out process, visit: + + http://{{site.domain}}{% url patchwork.views.confirm key=confirmation.key %} + +If you didn't request this opt-out, you don't need to do anything. + +Happy patchworking. diff --git a/templates/patchwork/optout.html b/templates/patchwork/optout.html new file mode 100644 index 0000000..6b97806 --- /dev/null +++ b/templates/patchwork/optout.html @@ -0,0 +1,22 @@ +{% extends "base.html" %} + +{% block title %}opt-out{% endblock %} +{% block heading %}opt-out{% endblock %} + +{% block body %} + +

Opt-out complete. You have successfully opted-out of +automated notifications from this patchwork system, from the address +{{email}}

+

Please note that you may still receive email from other patchwork setups at +different sites, as they are run independently. You may need to opt-out of +those separately.

+

If you later decide to receive mail from patchwork, just visit +http://{{site.domain}}{% url patchwork.views.mail.settings %}, or +visit the main patchwork page and navigate from there.

+{% if user.is_authenticated %} +

Return to your user +profile.

+{% endif %} +{% endblock %} diff --git a/templates/patchwork/profile.html b/templates/patchwork/profile.html index 44df921..130b947 100644 --- a/templates/patchwork/profile.html +++ b/templates/patchwork/profile.html @@ -40,34 +40,50 @@ Contributor to

The following email addresses are associated with this patchwork account. Adding alternative addresses allows patchwork to group contributions that you have made under different addresses.

+

The "notify?" column allows you to opt-in or -out of automated +patchwork notification emails. Setting it to "no" will disable automated +notifications for that address.

Adding a new email address will send a confirmation email to that address.

- +
- - - - + + {% for email in linked_emails %} - {% ifnotequal email.email user.email %} + - {% endifnotequal %} {% endfor %} -
email -
{{ user.email }}actionnotify?
{{ email.email }} - {% ifnotequal user.email email.email %} + {% ifnotequal user.email email.email %}
{% csrf_token %}
{% endifnotequal %} +
+ {% if email.is_optout %} +
+ No, + {% csrf_token %} + + +
+ {% else %} +
+ Yes, + {% csrf_token %} + + +
+ {% endif %} +
+
{% csrf_token %} {{ linkform.email }} -- cgit v1.2.3