From 0d0f1a92a8d1a3dd6368b4a87f11da28778e5a1d Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Thu, 11 Mar 2010 19:14:16 +1300 Subject: [PATCH] websites.concatenative: add a recaptcha to the pastebin --- extra/webapps/pastebin/new-paste.xml | 6 +----- extra/webapps/pastebin/paste.xml | 6 +----- extra/webapps/pastebin/pastebin.factor | 13 +++++++++---- extra/websites/concatenative/concatenative.factor | 11 +++++++++-- 4 files changed, 20 insertions(+), 16 deletions(-) diff --git a/extra/webapps/pastebin/new-paste.xml b/extra/webapps/pastebin/new-paste.xml index 9866c8819a..b202a19a0a 100644 --- a/extra/webapps/pastebin/new-paste.xml +++ b/extra/webapps/pastebin/new-paste.xml @@ -11,11 +11,7 @@ Author: Mode: Body: - Captcha: - - - Leave the captcha blank. Spam-bots will fill it indiscriminantly, so their attempts to register will be blocked. - +

diff --git a/extra/webapps/pastebin/paste.xml b/extra/webapps/pastebin/paste.xml index 6e1cb53664..d88e66450c 100644 --- a/extra/webapps/pastebin/paste.xml +++ b/extra/webapps/pastebin/paste.xml @@ -47,11 +47,7 @@ Author: Mode: Body: - Captcha: - - - Leave the captcha blank. Spam-bots will fill it indiscriminantly, so their attempts to register will be blocked. - +

diff --git a/extra/webapps/pastebin/pastebin.factor b/extra/webapps/pastebin/pastebin.factor index 48e6ed030b..684f6f0784 100644 --- a/extra/webapps/pastebin/pastebin.factor +++ b/extra/webapps/pastebin/pastebin.factor @@ -1,4 +1,4 @@ -! Copyright (C) 2007, 2008 Slava Pestov +! Copyright (C) 2007, 2010 Slava Pestov ! See http://factorcode.org/license.txt for BSD license. USING: namespaces assocs sorting sequences kernel accessors hashtables db.types db.tuples db combinators @@ -17,7 +17,9 @@ furnace.redirection furnace.auth furnace.auth.login furnace.boilerplate -furnace.syndication ; +furnace.recaptcha +furnace.syndication +furnace.conversations ; IN: webapps.pastebin TUPLE: pastebin < dispatcher ; @@ -156,8 +158,11 @@ M: annotation entity-url { "author" [ v-one-line ] } { "mode" [ v-mode ] } { "contents" [ v-required ] } - { "captcha" [ v-captcha ] } - } validate-params ; + } validate-params + + begin-conversation + validate-recaptcha + recaptcha-valid? cget [ validation-failed ] unless ; : deposit-entity-slots ( tuple -- ) now >>date diff --git a/extra/websites/concatenative/concatenative.factor b/extra/websites/concatenative/concatenative.factor index 92a4942fe6..efa4c4b635 100644 --- a/extra/websites/concatenative/concatenative.factor +++ b/extra/websites/concatenative/concatenative.factor @@ -19,6 +19,7 @@ furnace.auth.features.registration furnace.auth.features.deactivate-user furnace.boilerplate furnace.redirection +furnace.recaptcha webapps.pastebin webapps.planet webapps.wiki @@ -54,6 +55,12 @@ TUPLE: factor-website < dispatcher ; allow-edit-profile allow-deactivation ; +: ( responder -- responder' ) + + "concatenative.org" >>domain + "6LeJWQgAAAAAAFlYV7SuBClE9uSpGtV_ZS-qVON7" >>public-key + "6LeJWQgAAAAAALh-XJgSSQ6xKygRgJ8-029Ip2Xv" >>private-key ; + : ( -- responder ) factor-website new-dispatcher URL" /wiki/view/Front Page" "" add-responder ; @@ -77,7 +84,7 @@ SYMBOL: dh-file "wiki" add-responder "user-admin" add-responder - "pastebin" add-responder + "pastebin" add-responder "planet" add-responder "mason" add-responder "/tmp/docs/" "docs" add-responder @@ -96,7 +103,7 @@ SYMBOL: dh-file "wiki" add-responder "user-admin" add-responder test-db "concatenative.org" add-responder - test-db "paste.factorcode.org" add-responder + test-db "paste.factorcode.org" add-responder test-db "planet.factorcode.org" add-responder test-db "builds.factorcode.org" add-responder home "docs" append-path "docs.factorcode.org" add-responder