0

Anyone used the JCaptcha grails plugin know if this has a test mode (for use with automated testing, GEB/Selenium), or do I manually have to add a test parameter to my config file and check this in all controllers where the captcha is checked?

klogd
  • 1,118
  • 11
  • 19

1 Answers1

0

Did not find a test mode, but worked around it by defining a test mode variable in the grails config file.

    def captchaOK = false
    try {
        captchaOK = jcaptchaService.validateResponse("captchaImage", session.id, params.captchaText)
        }
    }
    catch(CaptchaServiceException cse) {
        captchaOK = false;
    }

Was replaced with:

    def captchaOK = false
    try {
        if(grailsApplication.config.capatchaTestMode == true) {
            captchaOK = true;
        }
        else {
            captchaOK = jcaptchaService.validateResponse("captchaImage", session.id, params.captchaText)
        }
    }
    catch(CaptchaServiceException cse) {
        captchaOK = false;
    }
klogd
  • 1,118
  • 11
  • 19