January 29 2011 Saturday
A simple CAPTCHA test for XPages...
While all are chatting around Lotusphere 2011, I am working for the community :)
Here is a simple CAPTCHA test for XPages...
It is not a turing test, actually. But it will keep spammer bots away until they become obsessed with your site...
You can download a sample database (see update below if you have problems). You are free to use, alter, extend or distribute this code. Just don't forget credits :) The screenshots are here:
It contains a custom control and a script library (SSJS). You may simply import these two into your database and include the custom control on your page. As I said, it is not a turing test. It just makes it difficult to exploit web forms. However, it is not impossible to break it...
The custom control also supports multi-language. Just update the list of languages supported and setStrings() function for custom strings...
UPDATE:
I noticed there is a problem with serialization in pre-8.5.2 versions. So I uploaded a different version as R2.0 here. Notice that the object structure and custom control implementation has been changed here and you should see different places for multilingual texts...
Here is a simple CAPTCHA test for XPages...
It is not a turing test, actually. But it will keep spammer bots away until they become obsessed with your site...
You can download a sample database (see update below if you have problems). You are free to use, alter, extend or distribute this code. Just don't forget credits :) The screenshots are here:
It contains a custom control and a script library (SSJS). You may simply import these two into your database and include the custom control on your page. As I said, it is not a turing test. It just makes it difficult to exploit web forms. However, it is not impossible to break it...
The custom control also supports multi-language. Just update the list of languages supported and setStrings() function for custom strings...
.....
var LANGUAGES=["en","tr"]; // Languages supported. First is default...
.......
this.setStrings=function() {
captchaTexts["en"]=["zero","one", ... ,"twentyfour","twentyfive"];
captchaTexts["tr"]=["sıfır","bir", ..., "yirmidört","yirmibeş"];
switch(captchaLanguage) {
case "en":
this.validationMessage="Are you sure about your math?";
this.emptyMessage="You forgot? Or you don't know about Math...";
this.chooseString="Choose...";
break;
case "tr":
this.validationMessage="Matematik bildiğinizden emin misiniz?";
this.emptyMessage="Unuttunuz mu? Yoksa matematikle sorununuz mu var?";
this.chooseString="Seçiniz...";
break;
}
}
UPDATE:
I noticed there is a problem with serialization in pre-8.5.2 versions. So I uploaded a different version as R2.0 here. Notice that the object structure and custom control implementation has been changed here and you should see different places for multilingual texts...
Comments (4)
Yep, I did notice this.
The problem is with the serialization of the captcha class.
I changed this with a serializable form and updated the post. Be careful that both custom control and script library has been changed.
thanks for application.
it's works on domino 8.5.2, but not in domino 8.5.1 FP2
error:
Source de l'erreur
Nom de page :/Sample.xsp
ID commande : scriptBlock1
Exception
Erreur lors de l'exécution de l'expression calculée JavaScript
Script-Interpreterfehler, Zeile=1, Spalte=11: Verweisfehler: 'myCaptcha' nicht gefunden
Javascript code
1: myCaptcha.captchaEncode(viewScope.get("cap1"))
Have you a solution ?
cordially
You can also implement CAPTCHA in Domino web forms using simply Notes formula language. :)
Security Image Generator (CAPTCHA) for Domino web forms
{ Link }