Skip to main content


         This documentation site is for previous versions. Visit our new documentation site for current releases.      
 

Fine-tuning the display and function of the CAPTCHA default

Updated on March 15, 2022

You can enable or disable the presentation of a CAPTCHA appears to those attempting to log in. You can fine-tune the details of the CAPTCHA, including how many characters drawn from what character set and what sort of background for the image.

  1. In the navigation of Dev Studio, click ConfigureSystemSettingsSecurity Policies.
  2. On the Security Policies landing page, find the pyGenerateCaptcha activity and save a copy with the same name into the ruleset you created for unauthenticated visitors.
  3. Expand step 1 to display the Java code.
  4. Make the adjustments you want and
  5. Click Save.
  6. Make sure that, on the Security Policies gadget, the CAPTCHA implementation policy is set to Default.
    Although you have modified the CAPTCHA, you are still using the default CAPTCHA provider.
    • Some typical adjustments to the CAPTCHA presentation include:
      • Modify the character set: add characters to, or remove them from, this section of the code:

        char[] DEFAULT_CHARS = new char[] { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'k', 'm', 'n', 'p', 'r', 'w', 'x', 'y', '2', '3', '4', '5', '6', '7', '8', };

      • Change the number of characters displayed by modifying the bolded number in this section of the code:
        nl.captcha.text.producer.DefaultTextProducer textProd = new nl.captcha.text.producer.DefaultTextProducer(6, DEFAULT_CHARS );
      • Change the color of the font by modifying the color specified in the bolded text in this line of the code:
        DEFAULT_COLORS.add(new java.awt.Color(0,51,102));
      • For more examples of modification that are available,, visit the SimpleCaptcha website,http://simplecaptcha.sourceforge.net/custom_images.html.
    • You can achieve any of the effects demonstrated on the SimpleCaptcha website. However you must use fully-qualified names in Pega Platform to refer to SimpleCaptcha classes. For example, the website demonstrates creating a CAPTCHA using a complex background and Chinese characters.
    • The SimpleCaptcha website provides the following code to achieve that CAPTCHA:
      • Captcha captcha = new Captcha.Builder(200, 50)
        .addText(new ChineseTextProducer(6)) // Answer will be 6 Chinese characters
        .addBackground(new GradiatedBackgroundProducer())
        .addNoise(new StraightLineNoiseProducer())
        .gimp(new FishEyeGimpyRenderer())
        .addBorder()
        .build(); // Required.
    • To get the same effect in Pega Platform, modify the code by using fully-qualified names, and add it to pyGenerateCaptcha:
      • nl.captcha.Captcha captcha = new nl.captcha.Captcha.Builder(200, 50)
        .addText(new nl.captcha.text.producer.ChineseTextProducer(6)) // Answer will be 6 Chinese characters
        .addBackground(new nl.captcha.backgrounds.GradiatedBackgroundProducer())
        .addNoise(new nl.captcha.noise.StraightLineNoiseProducer())
        .gimp(new nl.captcha.gimpy.FishEyeGimpyRenderer())
        .addBorder()
        .build(); // Required.
  • Previous topic Customizing CAPTCHA presentation and function
  • Next topic Substituting another service for the default CAPTCHA

Have a question? Get answers now.

Visit the Support Center to ask questions, engage in discussions, share ideas, and help others.

Did you find this content helpful?

Want to help us improve this content?

We'd prefer it if you saw us at our best.

Pega.com is not optimized for Internet Explorer. For the optimal experience, please use:

Close Deprecation Notice
Contact us