Your message dated Mon, 22 Aug 2011 17:32:27 +0000
with message-id <e1qvymn-0000xw...@franck.debian.org>
and subject line Bug#637880: fixed in moin 1.9.3-2
has caused the Debian Bug report #637880,
regarding Patch to add support for recaptcha
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact ow...@bugs.debian.org
immediately.)


-- 
637880: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=637880
Debian Bug Tracking System
Contact ow...@bugs.debian.org with problems
--- Begin Message ---
Package: python-moinmoin
Version: 1.9.3-1
Severity: wishlist
Tags: patch

Hi,

I've added simple support for using recaptcha, similar in design to
the existing textcha. So far I've only added this for the "newaccount"
action, but this could be extended to other actions if desired.

I've sent a patch upstream to the Moin folks (see
http://sourceforge.net/mailarchive/message.php?msg_id=27933760); the
one attached here is functionally the same, just slightly cleaned
up. This would also necessitate a Depends: on python-recaptcha.

Please consider this quickly - I've developed this recaptcha support
because we would like to use it for wiki.d.o. A backport of a version
in testing including this support would be ideal for us! :-)

-- System Information:
Debian Release: 6.0.2
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.32-5-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages python-moinmoin depends on:
ii  python                  2.6.6-3+squeeze6 interactive high-level object-orie
ii  python-parsedatetime    0.8.7-2          Python module to parse human-reada
ii  python-pygments         1.3.1+dfsg-1     syntax highlighting package writte
ii  python-support          1.0.10           automated rebuilding support for P
ii  python-werkzeug         0.6.2-1          collection of utilities for WSGI a

Versions of packages python-moinmoin recommends:
ii  apache2-mpm-worker [ht 2.2.16-6+squeeze1 Apache HTTP Server - high speed th
ii  exim4-daemon-light [ma 4.72-6+squeeze2   lightweight Exim MTA (v4) daemon
ii  fckeditor              1:2.6.6-1         rich text format javascript web ed
ii  python-xapian          1.2.3-3           Xapian search engine interface for
ii  python-xappy           0.5-4             easy-to-use interface to the Xapia

Versions of packages python-moinmoin suggests:
ii  antiword                  0.37-6         Converts MS Word files to text, PS
pn  catdoc                    <none>         (no description available)
pn  docbook-dsssl             <none>         (no description available)
ii  miscfiles [wordlist]      1.4.2.dfsg.1-9 Dictionaries and other interesting
ii  poppler-utils [xpdf-utils 0.12.4-1.2     PDF utilitites (based on libpopple
pn  python-4suite-xml         <none>         (no description available)
pn  python-docutils           <none>         (no description available)
pn  python-flup               <none>         (no description available)
pn  python-gdchart            <none>         (no description available)
pn  python-ldap               <none>         (no description available)
pn  python-mysqldb            <none>         (no description available)
pn  python-openid             <none>         (no description available)
pn  python-pyxmpp             <none>         (no description available)
ii  python-tz                 2010b-1        Python version of the Olson timezo
pn  python-xml                <none>         (no description available)
pn  smbfs                     <none>         (no description available)
ii  wamerican [wordlist]      6-3            American English dictionary words 
ii  wbritish [wordlist]       6-3            British English dictionary words f

-- Configuration Files:
/etc/moin/mywiki.py changed [not included]

-- no debconf information
diff -uNrBb --exclude support --exclude _tests --exclude i18n ./action/newaccount.py /usr/share/pyshared/MoinMoin/action/newaccount.py
--- ./action/newaccount.py	2010-06-26 22:46:40.000000000 +0100
+++ /usr/share/pyshared/MoinMoin/action/newaccount.py	2011-08-11 15:34:58.053890100 +0100
@@ -10,6 +10,7 @@
 from MoinMoin.Page import Page
 from MoinMoin.widget import html
 from MoinMoin.security.textcha import TextCha
+from MoinMoin.security.sec_recaptcha import ReCaptcha
 from MoinMoin.auth import MoinAuth
 
 
@@ -26,6 +27,9 @@
     if not TextCha(request).check_answer_from_form():
         return _('TextCha: Wrong answer! Go back and try again...')
 
+    if not ReCaptcha(request).check_answer_from_form():
+        return _('ReCaptcha: Wrong answer! Go back and try again...')
+
     # Create user profile
     theuser = user.User(request, auth_method="new-user")
 
@@ -143,6 +147,17 @@
             td.append(textcha.render())
         row.append(td)
 
+    recaptcha = ReCaptcha(request)
+    if recaptcha.is_enabled():
+        row = html.TR()
+        tbl.append(row)
+        row.append(html.TD().append(html.STRONG().append(
+                                      html.Text(_('ReCaptcha (required)')))))
+        td = html.TD()
+        if recaptcha:
+            td.append(recaptcha.render())
+        row.append(td)        
+
     row = html.TR()
     tbl.append(row)
     row.append(html.TD())
--- ./security/sec_recaptcha.py	1970-01-01 01:00:00.000000000 +0100
+++ /usr/share/pyshared/MoinMoin/security/sec_recaptcha.py	2011-08-15 14:11:40.944626628 +0100
@@ -0,0 +1,73 @@
+# -*- coding: iso-8859-1 -*-
+"""
+    MoinMoin - recaptcha support
+
+    Based heavily on the textcha support in textcha.py
+
+    @copyright: 2011 by Steve McIntyre
+    @license: GNU GPL, see COPYING for details.
+"""
+
+from MoinMoin import log
+from recaptcha.client import captcha
+import sys
+
+logging = log.getLogger(__name__)
+
+from MoinMoin import wikiutil
+
+class ReCaptcha(object):
+    """ Recaptcha support """
+
+    def __init__(self, request):
+        """ Initialize the Recaptcha setup.
+
+            @param request: the request object
+        """
+        self.request = request
+        self.user_info = request.user.valid and request.user.name or request.remote_addr
+        cfg = request.cfg
+
+        try:
+            if cfg.recaptcha_public_key:
+                self.public_key = cfg.recaptcha_public_key
+            if cfg.recaptcha_private_key:
+                self.private_key = cfg.recaptcha_private_key
+        except:
+            self.public_key = None
+            self.private_key = None
+
+    def is_enabled(self):
+        """ check if we're configured, i.e. we have a key
+        """
+        if (self.public_key and self.private_key):
+            return True
+        return False
+
+    def check_answer_from_form(self, form=None):
+        if self.is_enabled():
+            if form is None:
+                form = self.request.form
+            challenge = form.get('recaptcha_challenge_field')
+            response = form.get('recaptcha_response_field')
+            captcha_result = captcha.submit(challenge, response, self.private_key, self.request.remote_addr)
+            if captcha_result.is_valid:
+                logging.info(u"ReCaptcha: OK.")
+                return True
+            else:
+                logging.info(u"ReCaptcha: failed, error code %s." % captcha_result.error_code)
+                return False
+        else:
+            return True
+
+    def render(self, form=None):
+        """ Checks if ReCaptchas are enabled and returns HTML for one,
+            or an empty string if they are not enabled.
+
+            @return: unicode result html
+        """
+        if self.is_enabled():
+            result = captcha.displayhtml(self.public_key, use_ssl = True)
+        else:
+            result = u''
+        return result

--- End Message ---
--- Begin Message ---
Source: moin
Source-Version: 1.9.3-2

We believe that the bug you reported is fixed in the latest version of
moin, which is due to be installed in the Debian FTP archive:

moin_1.9.3-2.debian.tar.gz
  to main/m/moin/moin_1.9.3-2.debian.tar.gz
moin_1.9.3-2.dsc
  to main/m/moin/moin_1.9.3-2.dsc
python-moinmoin_1.9.3-2_all.deb
  to main/m/moin/python-moinmoin_1.9.3-2_all.deb



A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 637...@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Jonas Smedegaard <d...@jones.dk> (supplier of updated moin package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmas...@debian.org)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Format: 1.8
Date: Mon, 22 Aug 2011 19:13:00 +0200
Source: moin
Binary: python-moinmoin
Architecture: source all
Version: 1.9.3-2
Distribution: unstable
Urgency: low
Maintainer: Jonas Smedegaard <d...@jones.dk>
Changed-By: Jonas Smedegaard <d...@jones.dk>
Description: 
 python-moinmoin - Python clone of WikiWiki - library
Closes: 637880 638156
Changes: 
 moin (1.9.3-2) unstable; urgency=low
 .
   * Ease building with git-buildpackage:
     + Git-ignore quilt .pc dir.
     + Add source local-options.
   * Add patch to add simple support for using recaptcha.
     Closes: bug#637880. Thanks to Steve McIntyre.
   * Depend on python-recaptcha, required by recaptcha support.
   * Suggest cifs-utils (not smbfs).
     Closes: bug#638156. Thanks to Luk Claes.
   * Update copyright file:
     + Rewrite using draft 174 of DEP-5 format.
     + Add recaptcha patch, licensed GPL-2+.
   * Use Python helper python2 (not python-support).
   * Bump Policy compliance to Standards-Version 3.9.2.
Checksums-Sha1: 
 f8e84d998f873683eabdd3c34760fd5ff908e50e 1872 moin_1.9.3-2.dsc
 0e195431145e08b14b1e19c48357f6f87c039662 125053 moin_1.9.3-2.debian.tar.gz
 02701ee06304080cb776f903a5a286ea7eb37f27 15022552 
python-moinmoin_1.9.3-2_all.deb
Checksums-Sha256: 
 655802b50a148661fbcc9ae5f7ebeff678bbdc77e7e43964ebaa3754d8e24227 1872 
moin_1.9.3-2.dsc
 395f514307dc96fdfb66ca6e5e00018a4392731c39a2c6c9fb85e8a276b46829 125053 
moin_1.9.3-2.debian.tar.gz
 4fc64d122e95fcac36ae1e6c5baa35b8c23b3ce22fee27cf4ddf65f2f32af48b 15022552 
python-moinmoin_1.9.3-2_all.deb
Files: 
 4e94527c9bc5a3a2486e418a4ff401d0 1872 net optional moin_1.9.3-2.dsc
 f73486f35f98879030d905881ce6b721 125053 net optional moin_1.9.3-2.debian.tar.gz
 5f025590b19c1045341db64b64ce950d 15022552 python optional 
python-moinmoin_1.9.3-2_all.deb

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iQIcBAEBCgAGBQJOUpAEAAoJECx8MUbBoAEhnVUP/3oSiUos5wvpiqtMpWlitjNC
wxBg5mQU15xktYbY4Cc1DZ7hLz0WWFh5HIR2AkWYMrnYlJ9nxaruujBxwncND0Jn
Nfbheo7sYSD+WUi7VWEL14lhSpnw06byeHjvICx9YxROJScs6y3IOi5BqEFkXbDY
3PWHBBbdeITVsw/IL9KaTr/i5J9K29eKZ35IvfcZ3CdIKY+dUvTDBYm+Zji+gMCD
Vjd0H/8twy+mh/WE7QNzhKziG458FeccmDJtEXJO8NQuRdzCfv/q+h73IPmX15jf
L0O98c3M579jw+Uqq8cnJq4lsnbQQbDTro+vr36eE/UkzJtpP57rwTitIzH64rFb
C/r/EblSB51jvy3MGcwIA7L+t8vV32+0UvfdBx68xPHi9ww2Ds8NZx9yZ45k0qXf
YFVvZLBcfvksb22j67HWuiF7sFtiTlq1l+I5qJSdSi+MNYCV7buYS+z8EN2+EgFr
aPwqQImAfG0yp8KeFSOMMWwa7fkOSyfnRylsh54a09eDh1Ryoa8eQily3bNU9hRF
d2QIZxVfahqpz1ubU1vKW7BxhEEy27ezpiRemwICNjfEStW4bG1EuttCCOgchZSA
DUKoQVzGCm6LR6s5G2djrf2vp/bWg8ep0Tgvw2QcPbXERkuamXpgdyXIgWUpO26U
JXySkpRsp/+jwAHO0v/h
=hXAw
-----END PGP SIGNATURE-----



--- End Message ---

Reply via email to