Skip to content

Commit

Permalink
ERCaptcha
Browse files Browse the repository at this point in the history
Add Properties, javadoc and New Property for Word Generation
  • Loading branch information
ishimoto committed Jul 9, 2012
1 parent c27b914 commit 1d179c8
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 2 deletions.
5 changes: 4 additions & 1 deletion Frameworks/Misc/ERCaptcha/Documentation/README.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
ERCaptcha sits on top of the JCaptcha ( http://jcaptcha.sourceforge.net/ ) library. Because it uses AWT classes
for dynamic image generation, you must set -Djava.awt.headless=true on your application in deployment if you
do not run your applications as root.
do not run your applications as root.

ERCaptcha は JCaptcha ( http://jcaptcha.sourceforge.net/ ) ライブラリーの上に位置します。
ダイナミック・イメージ生成の為に、 AWT クラスを使用している為アプリケーションを配布時で -Djava.awt.headless=true として実行する必要があります。
12 changes: 12 additions & 0 deletions Frameworks/Misc/ERCaptcha/Resources/Properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
## Properies Info
er.extensions.load.Properties.framework.ERCaptcha=load
er.extensions.ERCaptcha.hasLocalization=false

#### ERReCaptcha
#er.captcha.recaptcha.publicKey=
#er.captcha.recaptcha.privateKey=

#### ERCaptchaEngine
er.captcha.ERCaptchaEngine.wordgenerator=BCDFGHJKLMNPQRSTVWXYZbcdfghjklmnpqrstvwxyz2346789

java.awt.headless=true
13 changes: 13 additions & 0 deletions Frameworks/Misc/ERCaptcha/Sources/er/captcha/ERCaptcha.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,26 @@
import er.extensions.foundation.ERXProperties;

/**
* <span class="en">
* ERCaptcha presents a captcha image to the use along with a text field for the user to identify the image.
*
* @binding validated returns whether or not the user properly validated the image
* @binding resetText if set, a submit button will be added with this text that resets the image
*
* @property er.captcha.captchaEngineClass the class name of the CaptchaEngine to use
* </span>
*
* <span class="ja">
* ERCaptcha は JCaptcha ( http://jcaptcha.sourceforge.net/ ) ライブラリーの上に位置します。
* ダイナミック・イメージ生成の為に、 AWT クラスを使用している為アプリケーションを配布時で -Djava.awt.headless=true として実行する必要があります。
* ERCaptcha はキャプチャ・イメージと確認用のユーザが使用できるテキスト・フィールドを表現します。
*
* @binding validated - ユーザがイメージを有効で認識できたかどうかを戻します。
* @binding resetText - セットされている場合には、イメージをリセットする為のサブミット・ボタンが表示されます。
*
* @property er.captcha.captchaEngineClass - 使用する CaptchaEngine のクラス名
* </span>
* @author mschrag
*/
public class ERCaptcha extends WOComponent {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,17 @@
import com.octo.captcha.engine.image.ListImageCaptchaEngine;
import com.octo.captcha.image.gimpy.GimpyFactory;

import er.extensions.foundation.ERXProperties;

/**
* ERCaptchaEngine is the default captcha engine for ERCaptcha.
*
* @author mschrag
*/
public class ERCaptchaEngine extends ListImageCaptchaEngine {

public static String WORD_GENERATOR = "er.captcha.ERCaptchaEngine.wordgenerator";

public ERCaptchaEngine() {
}

Expand All @@ -48,7 +53,7 @@ protected void buildInitialFactories() {
ImageDeformation postDef = new ImageDeformationByFilters(new ImageFilter[] { water });
WordToImage word2image = new DeformedComposedWordToImage(shearedFont, back, randomPaster, backDef, textDef, postDef);

WordGenerator dictionaryWords = new RandomWordGenerator("BCDFGHJKLMNPQRSTVWXYZbcdfghjklmnpqrstvwxyz2346789");
WordGenerator dictionaryWords = new RandomWordGenerator(ERXProperties.stringForKeyWithDefault(WORD_GENERATOR, "BCDFGHJKLMNPQRSTVWXYZbcdfghjklmnpqrstvwxyz2346789"));
addFactory(new GimpyFactory(dictionaryWords, word2image));
}
}

0 comments on commit 1d179c8

Please sign in to comment.