furnace.recaptcha: cleanups

db4
Slava Pestov 2010-03-11 19:13:57 +13:00
parent 7744559a46
commit 1f593f6bbc
3 changed files with 16 additions and 16 deletions

View File

@ -9,7 +9,7 @@ IN: furnace.recaptcha.example
TUPLE: recaptcha-app < dispatcher recaptcha ; TUPLE: recaptcha-app < dispatcher recaptcha ;
: recaptcha-db ( -- obj ) "recaptcha-example" <sqlite-db> ; : recaptcha-db ( -- obj ) "resource:recaptcha-example" <sqlite-db> ;
: <recaptcha-challenge> ( -- obj ) : <recaptcha-challenge> ( -- obj )
<page-action> <page-action>

View File

@ -26,7 +26,7 @@ ARTICLE: "recaptcha-example" "Recaptcha example"
{ "Wrap the responder in a " { $link <recaptcha> } } { "Wrap the responder in a " { $link <recaptcha> } }
{ "Wrap the responder in a " { $link <conversations> } " if it is not already" } { "Wrap the responder in a " { $link <conversations> } " if it is not already" }
{ "Ensure that there is a database connected, with the " { $link <alloy> } " word" } { "Ensure that there is a database connected, with the " { $link <alloy> } " word" }
{ "Start a conversation to move values between requests" } { "Start a conversation with " { $link begin-conversation } " to move values between requests" }
{ "Add a handler calling " { $link validate-recaptcha } " in the " { $slot "submit" } " of the " { $link page-action } } { "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> } } { "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 } } { "Put the chloe tag " { $snippet "<recaptcha/>" } " inside a form tag in the template for your " { $link page-action } }

View File

@ -23,23 +23,23 @@ M: recaptcha call-responder*
: (render-recaptcha) ( private-key -- xml ) : (render-recaptcha) ( private-key -- xml )
dup dup
[XML <script type="text/javascript" [XML
src=<->> <script type="text/javascript"
</script> src=<->>
</script>
<noscript> <noscript>
<iframe src=<-> <iframe src=<->
height="300" width="500" frameborder="0"></iframe><br/> height="300" width="500" frameborder="0"></iframe><br/>
<textarea name="recaptcha_challenge_field" rows="3" cols="40"> <textarea name="recaptcha_challenge_field" rows="3" cols="40">
</textarea> </textarea>
<input type="hidden" name="recaptcha_response_field" <input type="hidden" name="recaptcha_response_field"
value="manual_challenge"/> value="manual_challenge"/>
</noscript> </noscript>
XML] ; XML] ;
: recaptcha-url ( secure? -- ? ) : recaptcha-url ( secure? -- ? )
[ "https://api.recaptcha.net/challenge" ] "https://api.recaptcha.net/challenge" "http://api.recaptcha.net/challenge" ?
[ "http://api.recaptcha.net/challenge" ] if
recaptcha-error cget [ "?error=" glue ] when* >url ; recaptcha-error cget [ "?error=" glue ] when* >url ;
: render-recaptcha ( -- xml ) : render-recaptcha ( -- xml )