X-Git-Url: https://git.ralfj.de/ansible.git/blobdiff_plain/e950b50ac5f0ac5f5418554f260ab7916ea116bc..91f4ab8c6bc2b647a26eed10e42ea3a2a9377b95:/roles/email/files/mailman-patched/Cgi/listinfo.py?ds=inline diff --git a/roles/email/files/mailman-patched/Cgi/listinfo.py b/roles/email/files/mailman-patched/Cgi/listinfo.py index 0ce6393..0e38d03 100644 --- a/roles/email/files/mailman-patched/Cgi/listinfo.py +++ b/roles/email/files/mailman-patched/Cgi/listinfo.py @@ -1,4 +1,4 @@ -# Copyright (C) 1998-2016 by the Free Software Foundation, Inc. +# Copyright (C) 1998-2018 by the Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -38,8 +38,7 @@ _ = i18n._ i18n.set_language(mm_cfg.DEFAULT_SERVER_LANGUAGE) - - + def main(): parts = Utils.GetPathPieces() if not parts: @@ -61,7 +60,7 @@ def main(): # See if the user want to see this page in other language cgidata = cgi.FieldStorage() try: - language = cgidata.getvalue('language') + language = cgidata.getfirst('language') except TypeError: # Someone crafted a POST with a bad Content-Type:. doc = Document() @@ -79,8 +78,7 @@ def main(): list_listinfo(mlist, language) - - + def listinfo_overview(msg=''): # Present the general listinfo overview hostname = Utils.get_domain() @@ -117,7 +115,7 @@ def listinfo_overview(msg=''): else: advertised.append((mlist.GetScriptURL('listinfo'), mlist.real_name, - Utils.websafe(mlist.description))) + Utils.websafe(mlist.GetDescription()))) if msg: greeting = FontAttr(msg, color="ff5060", size="+1") else: @@ -175,8 +173,7 @@ def listinfo_overview(msg=''): print doc.Format() - - + def list_listinfo(mlist, lang): # Generate list specific listinfo doc = HeadlessDocument() @@ -221,16 +218,16 @@ def list_listinfo(mlist, lang): # for our hash so it doesn't matter. remote = remote.rsplit(':', 1)[0] # get CAPTCHA data - (captcha_question, captcha_box, captcha_idx) = Captcha.displayhtml(mlist, mm_cfg.CAPTCHAS) + (captcha_question, captcha_box, captcha_idx) = Captcha.display(mlist, mm_cfg.CAPTCHAS) replacements[''] = captcha_question replacements[''] = captcha_box # fill form replacements[''] += ( '\n' - % (now, captcha_idx, Utils.sha_new(mm_cfg.SUBSCRIBE_FORM_SECRET + - now + - captcha_idx + - mlist.internal_name() + + % (now, captcha_idx, Utils.sha_new(mm_cfg.SUBSCRIBE_FORM_SECRET + ":" + + now + ":" + + captcha_idx + ":" + + mlist.internal_name() + ":" + remote ).hexdigest() ) @@ -253,13 +250,25 @@ def list_listinfo(mlist, lang): replacements[''] = displang replacements[''] = mlist.FormatFormStart('listinfo') replacements[''] = mlist.FormatBox('fullname', size=30) + # If reCAPTCHA is enabled, display its user interface + if mm_cfg.RECAPTCHA_SITE_KEY: + noscript = _('This form requires JavaScript.') + replacements[''] = ( + """  + + +
+ """ + % (noscript, lang, mm_cfg.RECAPTCHA_SITE_KEY)) + else: + replacements[''] = '' # Do the expansion. doc.AddItem(mlist.ParseTags('listinfo.html', replacements, lang)) print doc.Format() - - + if __name__ == "__main__": main()