diff options
author | Jeremy Kerr <jk@ozlabs.org> | 2010-08-11 14:16:28 +0800 |
---|---|---|
committer | Jeremy Kerr <jk@ozlabs.org> | 2011-04-14 17:23:04 +0800 |
commit | 41f19b6643b44768dc06561c992c04ed6148477d (patch) | |
tree | 6f1c3d1fbe5e15e53d3c028a8e654f05b19e68fb /templates | |
parent | c2c6a408c7764fa29389ce160f52776c9308d50a (diff) | |
download | patchwork-41f19b6643b44768dc06561c992c04ed6148477d.tar.bz2 patchwork-41f19b6643b44768dc06561c992c04ed6148477d.tar.xz |
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 <jk@ozlabs.org>
Diffstat (limited to 'templates')
-rw-r--r-- | templates/base.html | 2 | ||||
-rw-r--r-- | templates/patchwork/mail-form.html | 38 | ||||
-rw-r--r-- | templates/patchwork/mail-settings.html | 37 | ||||
-rw-r--r-- | templates/patchwork/optin-request.html | 50 | ||||
-rw-r--r-- | templates/patchwork/optin-request.mail | 12 | ||||
-rw-r--r-- | templates/patchwork/optin.html | 19 | ||||
-rw-r--r-- | templates/patchwork/optout-request.html | 51 | ||||
-rw-r--r-- | templates/patchwork/optout-request.mail | 12 | ||||
-rw-r--r-- | templates/patchwork/optout.html | 22 | ||||
-rw-r--r-- | templates/patchwork/profile.html | 36 |
10 files changed, 269 insertions, 10 deletions
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 @@ <a href="{% url auth_login %}">login</a> <br/> <a href="{% url patchwork.views.user.register %}">register</a> + <br/> + <a href="{% url patchwork.views.mail.settings %}">mail settings</a> {% endif %} </div> <div style="clear: both;"></div> 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 %} + +<p>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.</p> + +<form method="post"> +{% csrf_token %} +<table class="form registerform"> +{% if form.errors %} + <tr> + <td colspan="2" class="error"> + There was an error accessing your mail settings: + </td> + </tr> +{% endif %} + <tr> + <th>{{ form.email.label_tag }}</th> + <td> + {{form.email}} + {{form.email.errors}} + </td> + </tr> + <tr> + <td colspan="2" class="submitrow"> + <input type="submit" value="Access mail settings"/> + </td> + </tr> +</table> +</form> + + +{% 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 %} +<p>Settings for <strong>{{email}}</strong>:</p> + +<table class="horizontal"> + <tr> + <th>Opt-out list</th> +{% if is_optout %} + <td>Patchwork <strong>may not</strong> send automated notifications to + this address.</td> + <td> + <form method="post" action="{% url patchwork.views.mail.optin %}"> + {% csrf_token %} + <input type="hidden" name="email" value="{{email}}"/> + <input type="submit" value="Opt-in"/> + </form> + </td> + +{% else %} + <td>Patchwork <strong>may</strong> send automated notifications to + this address.</td> + <td> + <form method="post" action="{% url patchwork.views.mail.optout %}"> + {% csrf_token %} + <input type="hidden" name="email" value="{{email}}"/> + <input type="submit" value="Opt-out"/> + </form> + </td> +{% endif %} + </tr> +</table> + +{% 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 %} +<p><strong>Opt-in confirmation email sent</strong></p> +<p>An opt-in confirmation mail has been sent to +<strong>{{confirmation.email}}</strong>, containing a link. Please click on +that link to confirm your opt-in.</p> +{% else %} +{% if error %} +<p class="error">{{error}}</p> +{% endif %} + +{% if form %} +<p>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.</p> +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.</p> +<form method="post" action=""> +{% csrf_token %} +{{form.email.errors}} +<div style="padding: 0.5em 1em 2em;"> +{{form.email.label_tag}}: {{form.email}} +</div> +<input type="submit" value="Send me an opt-in link"> +</form> +{% endif %} + +{% if error and admins %} +<p>If you are having trouble opting in, please email +{% for admin in admins %} +{% if admins|length > 1 and forloop.last %} or {% endif %} +{{admin.0}} <<a href="mailto:{{admin.1}}">{{admin.1}}</a +>>{% if admins|length > 2 and not forloop.last %}, {% endif %} +{% endfor %} +{% endif %} + +{% endif %} + +{% if user.is_authenticated %} +<p>Return to your <a href="{% url patchwork.views.user.profile %}">user +profile</a>.</p> +{% 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 %} + +<p><strong>Opt-in complete</strong>. You have sucessfully opted back in to +automated email from this patchwork system, using the address +<strong>{{email}}</strong>.</p> +<p>If you later decide that you no longer want to receive automated mail from +patchwork, just visit <a href="{% url patchwork.views.mail.settings %}" +>http://{{site.domain}}{% url patchwork.views.mail.settings %}</a>, or +visit the main patchwork page and navigate from there.</p> +{% if user.is_authenticated %} +<p>Return to your <a href="{% url patchwork.views.user.profile %}">user +profile</a>.</p> +{% 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 %} +<p><strong>Opt-out confirmation email sent</strong></p> +<p>An opt-out confirmation mail has been sent to +<strong>{{confirmation.email}}</strong>, containing a link. Please click on +that link to confirm your opt-out.</p> +{% else %} +{% if error %} +<p class="error">{{error}}</p> +{% endif %} + +{% if form %} +<p>This form allows you to opt-out of automated email from patchwork.</p> +<p>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.</p> +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.</p> +<form method="post" action=""> +{% csrf_token %} +{{form.email.errors}} +<div style="padding: 0.5em 1em 2em;"> +{{form.email.label_tag}}: {{form.email}} +</div> +<input type="submit" value="Send me an opt-out link"> +</form> +{% endif %} + +{% if error and admins %} +<p>If you are having trouble opting out, please email +{% for admin in admins %} +{% if admins|length > 1 and forloop.last %} or {% endif %} +{{admin.0}} <<a href="mailto:{{admin.1}}">{{admin.1}}</a +>>{% if admins|length > 2 and not forloop.last %}, {% endif %} +{% endfor %} +{% endif %} + +{% endif %} + +{% if user.is_authenticated %} +<p>Return to your <a href="{% url patchwork.views.user.profile %}">user +profile</a>.</p> +{% 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 %} + +<p><strong>Opt-out complete</strong>. You have successfully opted-out of +automated notifications from this patchwork system, from the address +<strong>{{email}}</strong></p> +<p>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.</p> +<p>If you later decide to receive mail from patchwork, just visit +<a href="{% url patchwork.views.mail.settings %}" +>http://{{site.domain}}{% url patchwork.views.mail.settings %}</a>, or +visit the main patchwork page and navigate from there.</p> +{% if user.is_authenticated %} +<p>Return to your <a href="{% url patchwork.views.user.profile %}">user +profile</a>.</p> +{% 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 <p>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.</p> +<p>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.</p> <p>Adding a new email address will send a confirmation email to that address.</p> -<table class="vertical" style="width: 20em;"> +<table class="vertical"> <tr> <th>email</th> - <th/> - </tr> - <tr> - <td>{{ user.email }}</td> - <td></td> + <th>action</th> + <th>notify?</th> </tr> {% for email in linked_emails %} - {% ifnotequal email.email user.email %} <tr> <td>{{ email.email }}</td> <td> - {% ifnotequal user.email email.email %} + {% ifnotequal user.email email.email %} <form action="{% url patchwork.views.user.unlink person_id=email.id %}" method="post"> {% csrf_token %} <input type="submit" value="Unlink"/> </form> {% endifnotequal %} + </td> + <td> + {% if email.is_optout %} + <form method="post" action="{% url patchwork.views.mail.optin %}"> + No, + {% csrf_token %} + <input type="hidden" name="email" value="{{email.email}}"/> + <input type="submit" value="Opt-in"/> + </form> + {% else %} + <form method="post" action="{% url patchwork.views.mail.optout %}"> + Yes, + {% csrf_token %} + <input type="hidden" name="email" value="{{email.email}}"/> + <input type="submit" value="Opt-out"/> + </form> + {% endif %} + </td> </tr> - {% endifnotequal %} {% endfor %} <tr> - <td colspan="2"> + <td colspan="3"> <form action="{% url patchwork.views.user.link %}" method="post"> {% csrf_token %} {{ linkform.email }} |