2009-09-16 16:17:15 -04:00
! Copyright (C) 2009 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
USING: help.markup help.syntax http.server.filters kernel
2009-09-17 12:48:49 -04:00
multiline furnace.actions furnace.alloy furnace.conversations ;
2009-09-17 12:13:33 -04:00
IN: furnace.recaptcha
2009-09-16 16:17:15 -04:00
HELP: <recaptcha>
{ $values
{ "responder" "a responder" }
2010-03-11 03:02:39 -05:00
{ "recaptcha" recaptcha }
2009-09-16 16:17:15 -04:00
}
2010-03-11 03:02:39 -05:00
{ $description "A " { $link filter-responder } " wrapping another responder. Set the domain, public, and private keys using the key you get by registering with recaptcha." } ;
2009-09-16 16:17:15 -04:00
HELP: recaptcha-error
2010-03-11 03:02:39 -05:00
{ $var-description "Set to the error string returned by the recaptcha server." } ;
2009-09-16 16:17:15 -04:00
HELP: recaptcha-valid?
2010-03-11 03:02:39 -05:00
{ $var-description "Set to " { $link t } " if the user solved the last recaptcha correctly." } ;
2009-09-16 16:17:15 -04:00
HELP: validate-recaptcha
2010-03-11 03:02:39 -05:00
{ $description "Validates a recaptcha using the recaptcha web service API." } ;
2009-09-16 16:17:15 -04:00
ARTICLE: "recaptcha-example" "Recaptcha example"
2010-03-11 03:02:39 -05:00
"There are several steps to using the recaptcha library."
2009-09-16 16:17:15 -04:00
{ $list
{ "Wrap the responder in a " { $link <recaptcha> } }
2010-03-11 03:02:39 -05:00
{ "Wrap the responder in an " { $link <alloy> } " if it is not already, to enable conversations and database access" }
{ "Call " { $link validate-recaptcha } " from the " { $slot "validate" } " slot of the " { $link action } }
{ "Put the chloe tag " { $snippet "<recaptcha/>" } " inside a form tag in the template served by your " { $link action } }
2009-09-16 16:17:15 -04:00
}
2009-09-17 12:48:49 -04:00
$nl
2010-03-11 03:02:39 -05:00
"There is an example web app using recaptcha support:"
2009-09-16 16:17:15 -04:00
{ $code
2010-03-11 03:02:39 -05:00
"USING: furnace.recaptcha.example http.server ;"
2009-09-17 12:48:49 -04:00
"<recaptcha-app> main-responder set-global"
2010-03-11 03:02:39 -05:00
"8080 httpd"
2009-09-17 12:48:49 -04:00
} ;
2009-09-16 16:17:15 -04:00
2010-03-11 03:02:39 -05:00
ARTICLE: "furnace.recaptcha" "Recaptcha support for Furnace"
"The " { $vocab-link "furnace.recaptcha" } " vocabulary implements support for the recaptcha. Recaptcha is a web service that provides the user with a captcha, a test that is easy to solve by visual inspection, but hard to solve by writing a computer program. Use a captcha to protect forms from abusive users." $nl
2009-09-16 16:17:15 -04:00
2010-03-11 03:02:39 -05:00
"The recaptcha responder is a " { $link filter-responder } " that wraps another responder. Set the " { $slot "domain" } ", " { $slot "public-key" } ", and " { $slot "private-key" } " slots of this responder to your recaptcha account information." $nl
2009-09-16 16:17:15 -04:00
2010-03-11 03:02:39 -05:00
"Wrapping a responder with recaptcha support:"
2009-10-01 15:56:36 -04:00
{ $subsections <recaptcha> }
2009-09-16 16:17:15 -04:00
"Validating recaptcha:"
2009-10-01 15:56:36 -04:00
{ $subsections validate-recaptcha }
2009-09-16 16:17:15 -04:00
"Symbols set after validation:"
2009-10-01 15:56:36 -04:00
{ $subsections
recaptcha-valid?
recaptcha-error
2010-03-11 03:02:39 -05:00
}
"An example:"
{ $subsections
2009-10-01 15:56:36 -04:00
"recaptcha-example"
} ;
2009-09-16 16:17:15 -04:00
2009-09-17 12:13:33 -04:00
ABOUT: "furnace.recaptcha"