Xpages Captcha Custom Control

Customizable captcha custom control for Xpages. The screenshot below explains it all.
Check out the documentation on how to implement it in your own application. 

  

 

 

These are the properties of the custom control :

 

Property

Type

Default

Description

border

String

yes

Show a border around the captcha image.

borderColor

string

black

Color of the border.

Use a comma separated string for RGB

 

e.g. "255,168,0"

borderThickness

string

1

Thickness of the border around captcha.

imageWidth

string

300

Width in pixels of the captcha image.

imageHeight

string

75

Height in pixels of the captcha image.

characters

string

abcde2345678

gfynmnpwx

The characters that will create the captcha.

textLength

string

5

The number of characters to display.

fontFamily

string

Arial,Courier

A list of comma separated font names to use in the captcha.

fontColor

string

255,168,0

The color to use for the font.

Use a comma separated string for RGB

 

e.g. "255,168,0"

fontSize

string

40

The size of the font to use. This must be in pixels

fontSpace

string

7

The space between the characters.

noiseColor

string

black

The noise color. You may use names for the color, like 'black' or 'red'

Use a comma seperated string for RGB

backgroundColorStart

string

192,192,192

Starting background color. You may use names for the color, like 'black' or 'red'

Use a comma seperated string for RGB

backgroundColorEnd

String

white

Ending background color. You may use names for the color, like 'black' or 'red'

Use a comma seperated string for RGB

captchaReloadAlt

Localized string

Click to regenerate a new captcha image

Enter a text for the action where users may 'regenerate' the image when they can not read it.

captchaWrongInputMessage

Localized string

Invalid code! Please try again.

The validation message to the user when the input wrong.

captchaShowInputbox

boolean

true

When not showing the inputbox, you could add an inputbox elsewhere on your Xpage.

For validation use a validationExpression with the value '@LowerCase(value) == @LowerCase(sessionScope.get("ccCaptchaText"))'.

The correct Captcha anwer is stored in the sessionScope.

You could store the answer in the requestScope

captchaInputRequiredMessage

Localized string

 

The message when a user forgets to type the letters from the image into the textbox.

captchaShowInputValidationMessage

boolean

 

When also showing the inputbox, you can turn of the validation message for the input control.

You can turn this control of when you have a 'Display Errors' control anywhere else on your Xpage. Turning this off and no Display Errors control on your Xpage will result in no Captcha validation!