aboutsummaryrefslogtreecommitdiffstats
path: root/Mailman/Cgi/listinfo.py
diff options
context:
space:
mode:
authorYasuhito FUTATSUKI at POEM <futatuki@poem.co.jp>2019-06-21 07:51:01 +0900
committerYasuhito FUTATSUKI at POEM <futatuki@poem.co.jp>2019-06-21 07:51:01 +0900
commit3d32d14b3929489226106ee935bcbb6242b71866 (patch)
tree91507de6cf467ed68f63e6d1aa6c29c317ca662f /Mailman/Cgi/listinfo.py
parent83402ad71a22c272ea825068e496efc7fdcebb86 (diff)
parenta5de21c5b47e37b65f66975e7a8ca82be2bc3de4 (diff)
downloadmailman2-3d32d14b3929489226106ee935bcbb6242b71866.tar.gz
mailman2-3d32d14b3929489226106ee935bcbb6242b71866.tar.xz
mailman2-3d32d14b3929489226106ee935bcbb6242b71866.zip
merge lp:mailman/2.1 up to rev 1817
Diffstat (limited to 'Mailman/Cgi/listinfo.py')
-rw-r--r--Mailman/Cgi/listinfo.py22
1 files changed, 20 insertions, 2 deletions
diff --git a/Mailman/Cgi/listinfo.py b/Mailman/Cgi/listinfo.py
index f1b455da..81ff7f48 100644
--- a/Mailman/Cgi/listinfo.py
+++ b/Mailman/Cgi/listinfo.py
@@ -216,10 +216,28 @@ def list_listinfo(mlist, lang):
# drop one : resulting in an invalid format, but it's only
# for our hash so it doesn't matter.
remote = remote.rsplit(':', 1)[0]
+ # render CAPTCHA, if configured
+ if isinstance(mm_cfg.CAPTCHAS, dict) and 'en' in mm_cfg.CAPTCHAS:
+ (captcha_question, captcha_box, captcha_idx) = \
+ Utils.captcha_display(mlist, lang, mm_cfg.CAPTCHAS)
+ pre_question = _(
+ """Please answer the following question to prove that
+ you are not a bot:"""
+ )
+ replacements['<mm-captcha-ui>'] = (
+ """<tr><td BGCOLOR="#dddddd">%s<br>%s</td><td>%s</td></tr>"""
+ % (pre_question, captcha_question, captcha_box))
+ else:
+ # just to have something to include in the hash below
+ captcha_idx = ''
+ # fill form
replacements['<mm-subscribe-form-start>'] += (
- '<input type="hidden" name="sub_form_token" value="%s:%s">\n'
- % (now, Utils.sha_new(mm_cfg.SUBSCRIBE_FORM_SECRET + ":" +
+ '<input type="hidden" name="sub_form_token"'
+ ' value="%s:%s:%s">\n'
+ % (now, captcha_idx,
+ Utils.sha_new(mm_cfg.SUBSCRIBE_FORM_SECRET + ":" +
now + ":" +
+ captcha_idx + ":" +
mlist.internal_name() + ":" +
remote
).hexdigest()