Package net.tanesha.recaptcha

Examples of net.tanesha.recaptcha.ReCaptchaResponse


        String captchaScript = getCaptcha().createRecaptchaHtml(error, null);
        out.write(captchaScript.getBytes());
    }

    public boolean verifyCaptcha(String id, String value) {
        ReCaptchaResponse response = getCaptcha().checkAnswer(
                request.getRemoteAddr(),
                request.getParameter("recaptcha_challenge_field"),
                request.getParameter("recaptcha_response_field")
        );
        return response.isValid();
    }
View Full Code Here


        String challenge = request.getParameter("recaptcha_challenge_field");
        String uresponse = request.getParameter("recaptcha_response_field");
        if (challenge == null || uresponse == null) {
          throw new ValidatorException(new FacesMessage("No ReCaptcha text. Maybe you have JavaScript disabled. Please enable and retry."));
        }
        ReCaptchaResponse reCaptchaResponse = reCaptcha.checkAnswer(remoteAddr, challenge, uresponse);

        if (reCaptchaResponse.isValid()) {
            return;
        } else {
            throw new ValidatorException(new FacesMessage("Invalid ReCaptcha text. Please try again."));
        }
    }
View Full Code Here

TOP

Related Classes of net.tanesha.recaptcha.ReCaptchaResponse

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.