Skip to main content

Table of Contents

Fine-tuning the display and function of the CAPTCHA default


Only available versions of this content are shown in the dropdown

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 Configure System Settings Security 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,
    • 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())
        .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())
        .build(); // Required.
Did you find this content helpful?

Have a question? Get answers now.

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

Ready to crush complexity?

Experience the benefits of Pega Community when you log in.

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

Pega Community has detected you are using a browser which may prevent you from experiencing the site as intended. To improve your experience, please update your browser.

Close Deprecation Notice
Contact us