diff MoinMoin/action/newaccount.py @ 2983:7b0aadb97d01

new antispam stuff: textchas (text CAPTCHAs), cleanup AttachFile handler (port from 1.6)
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sun, 06 Jan 2008 02:49:32 +0100
parents a310264ad186
children c5cc1a0db4b2
line wrap: on
line diff
--- a/MoinMoin/action/newaccount.py	Sat Jan 05 23:41:20 2008 +0100
+++ b/MoinMoin/action/newaccount.py	Sun Jan 06 02:49:32 2008 +0100
@@ -10,6 +10,7 @@
 from MoinMoin.Page import Page
 from MoinMoin.widget import html
 import MoinMoin.events as events
+from MoinMoin.security.textcha import TextCha
 
 
 _debug = False
@@ -20,6 +21,10 @@
 
     if request.request_method != 'POST':
         return _("Use UserPreferences to change your settings or create an account.")
+           
+    if not TextCha(request).check_answer_from_form():
+        return _('TextCha: Wrong answer! Go back and try again...', formatted=False)
+
     # Create user profile
     theuser = user.User(request, auth_method="new-user")
 
@@ -127,6 +132,16 @@
 
     row = html.TR()
     tbl.append(row)
+    row.append(html.TD().append(html.STRONG().append(
+                                  html.Text(_('TextCha (required)', formatted=False))))) 
+    td = html.TD()
+    textcha = TextCha(request).render()
+    if textcha:
+        td.append(textcha)
+    row.append(td)
+
+    row = html.TR()
+    tbl.append(row)
     row.append(html.TD())
     td = html.TD()
     row.append(td)