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 ;
: recaptcha-db ( -- obj ) "recaptcha-example" <sqlite-db> ;
: recaptcha-db ( -- obj ) "resource:recaptcha-example" <sqlite-db> ;
: <recaptcha-challenge> ( -- obj )
<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 <conversations> } " if it is not already" }
{ "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 } }
{ "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 } }

View File

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