BoxLang 🚀 A New JVM Dynamic Language Learn More...
This module will add Captcha Security to your comment forms that can
be distributed in a cluster as it leverages the
CacheStorages
module.
Just use CommandBox: box install contentbox-captcha
,
then visit your ContentBox administrator and activate the module in
the Modules section.
This module will automatically add Captcha security to your comment forms. However, you can also leverage it to add it to any form.
You can display the captcha by using the following code:
<!-- Display Captch using /contentbox-captcha entry point -->
<img src='#event.buildLink( 'contentbox-captcha' )#' />
<!-- Field For Input -->
#HTMLHelper.textField(
name = "captchacode",
label = "Enter the security code shown above:",
required = "required",
class = "form-control",
groupWrapper = "div class=form-group",
size = "50"
)#
You will need access to the captcha service which is registered in
WireBox as CaptchaService@contentbox-captcha
. You can
inject it in your handlers like so:
property name="captchaService" inject="id:CaptchaService@contentbox-captcha";
You can then in the receiving action validate it using something like this:
if( !captchaService.validate( rc.captchacode ){
// Captcha is invalid.
}
Apache License, Version 2.0.
"I am the way, and the truth, and the life; no one comes to the Father, but by me (JESUS)" Jn 14:1-12
$
box install contentbox-captcha