Archive

Posts Tagged ‘Captcha’

XWiki – Add recaptcha support

November 27th, 2009 Asiri Rathnayake No comments

Here’s an xwiki component that integrates recaptcha support into xwiki: xwiki.recaptcha.zip. It can be tested with the following xwiki code snippet:

{{velocity}}
#if("$!{request.recaptcha_challenge_field}" != "")
  #if($recaptcha.isValid($request))
    {{info}}Recaptcha validation succeeded.{{/info}}
  #else
    {{error}}Recaptcha validation failed.{{/error}}
  #end
#end
{{html}}
<form action="$doc.URL" method="post">
  <div id="recaptcha_box"></div>
  <input type="submit" value="Validate"/>
</form>
<script type="text/javascript">
  Recaptcha.
    create("$recaptcha.publicKey", "recaptcha_box", {theme: "red"});
</script>
{{/html}}
{{/velocity}}

However, integrating recaptcha support into xwiki functions (like for comments) is bit tricky and requires some hacking.

UPDATE: From XE 2.3 onwards XWiki has built-in captcha support.

Categories: Java, Technology, XWiki Tags: , ,