aboutsummaryrefslogtreecommitdiffstats
path: root/Mailman/Cgi/listinfo.py
diff options
context:
space:
mode:
authorDavid Siebörger <drs@sieborger.nom.za>2018-01-29 14:58:42 +0200
committerDavid Siebörger <drs@sieborger.nom.za>2018-01-29 14:58:42 +0200
commit993d81c2ce98a6579b3110a6013c00090dfddaea (patch)
tree4dc585e377553f711eb22678eddd79460b3755a1 /Mailman/Cgi/listinfo.py
parente76749fe918f58c453aab77f0c53ac0342afdadf (diff)
downloadmailman2-993d81c2ce98a6579b3110a6013c00090dfddaea.tar.gz
mailman2-993d81c2ce98a6579b3110a6013c00090dfddaea.tar.xz
mailman2-993d81c2ce98a6579b3110a6013c00090dfddaea.zip
Allow the list subscription form to be protected from spam bots using
reCAPTCHA.
Diffstat (limited to '')
-rw-r--r--Mailman/Cgi/listinfo.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/Mailman/Cgi/listinfo.py b/Mailman/Cgi/listinfo.py
index b8704486..91f5b6bb 100644
--- a/Mailman/Cgi/listinfo.py
+++ b/Mailman/Cgi/listinfo.py
@@ -243,6 +243,16 @@ def list_listinfo(mlist, lang):
replacements['<mm-displang-box>'] = displang
replacements['<mm-lang-form-start>'] = mlist.FormatFormStart('listinfo')
replacements['<mm-fullname-box>'] = mlist.FormatBox('fullname', size=30)
+ # If reCAPTCHA is enabled, display its user interface
+ if mm_cfg.RECAPTCHA_SITE_KEY:
+ replacements['<mm-recaptcha-ui>'] = (
+ """<tr><td>&nbsp;</td><td>
+ <script src="https://www.google.com/recaptcha/api.js"></script>
+ <div class="g-recaptcha" data-sitekey="%s"></div>
+ </td></tr>"""
+ % mm_cfg.RECAPTCHA_SITE_KEY)
+ else:
+ replacements['<mm-recaptcha-ui>'] = ''
# Do the expansion.
doc.AddItem(mlist.ParseTags('listinfo.html', replacements, lang))