[jbossseam-issues] [JBoss JIRA] Commented: (JBSEAM-865) Allow customisation of Captcha images

Shane Bryzak (JIRA) jira-events at lists.jboss.org
Wed Sep 19 00:34:10 EDT 2007


    [ http://jira.jboss.com/jira/browse/JBSEAM-865?page=comments#action_12377528 ] 
            
Shane Bryzak commented on JBSEAM-865:
-------------------------------------

I suppose I'd better add some more info :)

To configure a custom captcha image generator, configure the captchaImage component in components.xml like this:

<component name="org.jboss.seam.captcha.captchaImage" service="#{customCaptcha.service}"/>

Then create a method somewhere in your project that returns your customised ImageCaptchaService :

@Name("customCaptcha")
public class CustomCaptcha
{
   public ImageCaptchaService getService()
   {
      BasicGimpyEngine customCaptcha = new BasicGimpyEngine();
      GimpyFactory factory = new GimpyFactory(
            new RandomWordGenerator("ABCDEFGHIJKLMNOPQRSTUVWXYZ23456789"), 
            new ComposedWordToImage(new RandomFontGenerator(new Integer(15), 
                  new Integer(15)), new UniColorBackgroundGenerator(new Integer(150), 
                        new Integer(30)), new RandomTextPaster(new Integer(4), 
                              new Integer(7), Color.BLACK)));
      GimpyFactory[] factories = {factory};
      customCaptcha.setFactories(factories);
      
      return new DefaultManageableImageCaptchaService(
                   new FastHashMapCaptchaStore(),
                   customCaptcha,
                   180,
                   120000,
                   75000);      
   }
}


You can see this in action in the seamspace example.

> Allow customisation of Captcha images
> -------------------------------------
>
>                 Key: JBSEAM-865
>                 URL: http://jira.jboss.com/jira/browse/JBSEAM-865
>             Project: JBoss Seam
>          Issue Type: Feature Request
>          Components: Security
>    Affects Versions: 1.1.6.GA
>            Reporter: Shane Bryzak
>         Assigned To: Shane Bryzak
>            Priority: Minor
>             Fix For: 2.0.0.GA
>
>   Original Estimate: 2 hours
>  Remaining Estimate: 2 hours
>
> We should allow configuration of the captcha service to use a different engine.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the seam-issues mailing list