factor/basis/furnace/recaptcha/recaptcha-docs.factor

58 lines
2.6 KiB
Factor
Raw Normal View History

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
multiline furnace.actions furnace.alloy furnace.conversations ;
IN: furnace.recaptcha
2009-09-16 16:17:15 -04:00
HELP: <recaptcha>
{ $values
{ "responder" "a responder" }
{ "obj" object }
}
{ $description "A " { $link filter-responder } " wrapping another responder. Set the domain, public, and private keys using the key you get by registering with Recaptcha." } ;
HELP: recaptcha-error
{ $var-description "Set to the error string returned by the Recaptcha server." } ;
HELP: recaptcha-valid?
{ $var-description "Set to " { $link t } " if the user solved the last Recaptcha correctly." } ;
HELP: validate-recaptcha
{ $description "Validates a Recaptcha using the Recaptcha web service API." } ;
ARTICLE: "recaptcha-example" "Recaptcha example"
"There are several steps to using the Recaptcha library."
{ $list
{ "Wrap the responder in a " { $link <recaptcha> } }
{ "Wrap the responder in a " { $link <conversations> } " if it is not already" }
{ "Ensure that there is a database connected, with the " { $link <alloy> } " word" }
2010-03-11 01:13:57 -05:00
{ "Start a conversation with " { $link begin-conversation } " to move values between requests" }
2009-09-16 16:17:15 -04:00
{ "Add a handler calling " { $link validate-recaptcha } " in the " { $slot "submit" } " of the " { $link page-action } }
{ "Pass the conversation from your submit action using " { $link <continue-conversation> } }
{ "Put the chloe tag " { $snippet "<recaptcha/>" } " inside a form tag in the template for your " { $link page-action } }
2009-09-16 16:17:15 -04:00
}
$nl
"Run this example vocabulary:"
2009-09-16 16:17:15 -04:00
{ $code
"USE: furnace.recaptcha.example"
"<recaptcha-app> main-responder set-global"
} ;
2009-09-16 16:17:15 -04:00
ARTICLE: "furnace.recaptcha" "Recaptcha"
2009-09-17 16:09:45 -04:00
"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
"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
"Wrapping a responder with Recaptcha:"
{ $subsections <recaptcha> }
2009-09-16 16:17:15 -04:00
"Validating recaptcha:"
{ $subsections validate-recaptcha }
2009-09-16 16:17:15 -04:00
"Symbols set after validation:"
{ $subsections
recaptcha-valid?
recaptcha-error
"recaptcha-example"
} ;
2009-09-16 16:17:15 -04:00
ABOUT: "furnace.recaptcha"