Examples of ReCaptchaResponse


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

Examples of net.tanesha.recaptcha.ReCaptchaResponse

        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

Examples of org.encuestame.utils.captcha.ReCaptchaResponse

        log.info("result erros  " + result.getAllErrors().size());
        log.info("result erros  " + result.getErrorCount());
        final String email = user.getEmail() == null ? "" : user.getEmail();
        if (!email.isEmpty()) {
                log.debug("email " + email);
                final ReCaptchaResponse reCaptchaResponse = getReCaptcha().checkAnswer(
                        req.getRemoteAddr(), challenge, response);
                final ValidateOperations validation = new ValidateOperations(
                        getSecurityService());
                boolean _isValidEmailFormat = validation.validateEmail(email);
                log.info("EMAIL FORMAT NOT VALID --> " + _isValidEmailFormat);
                if (_isValidEmailFormat) {
                     final UserAccount userValidate = validation.checkifEmailExist(email);
                     if (userValidate == null) {
                         result.rejectValue("email", "secure.email.notvalid", new Object[] { user.getEmail() }, "");
                     }
                     log.info("reCaptchaResponse " + reCaptchaResponse.isValid());
                     //validate reCaptcha
                     validation.validateCaptcha(reCaptchaResponse, result);
                     if(reCaptchaResponse.getErrorMessage() != null) {
                         RequestSessionMap.getCurrent(req).put("resetError", Boolean.TRUE);
                         RequestSessionMap.getCurrent(req).put("resetErrorMessage", reCaptchaResponse.getErrorMessage());
                         log.fatal("reCaptcha Fatal Error: "+reCaptchaResponse.getErrorMessage());
                     }
                    log.info("result.hasErrors() " + result.hasErrors());
                    if (result.hasErrors()) {
                        return "forgot";
                    } else {
View Full Code Here

Examples of org.encuestame.utils.captcha.ReCaptchaResponse

             log.info("vote2--> "+vote.toString());
             final String IP = getIpClient(req);
             //security service
             final SecurityOperations securityService = getServiceManager().getApplicationServices().getSecurityService();
             //check if captcha is valid
             final ReCaptchaResponse reCaptchaResponse = getReCaptcha().checkAnswer(req.getRemoteAddr(), challenge, response);
             //validation layer
             final ValidateOperations validation = new ValidateOperations(securityService);
             validation.validateCaptcha(reCaptchaResponse, result);
             log.info("reCaptchaResponse "+reCaptchaResponse.getErrorMessage());
             log.info("reCaptchaResponse "+reCaptchaResponse.isValid());
             log.info("result.hasErrors() "+result.hasErrors());
             if (result.hasErrors()) {
                //build new reCAPTCHA
                final String errMsg = reCaptchaResponse.getErrorMessage();
                final String html = getReCaptcha().createRecaptchaHtml(errMsg, null);
                vote.setCaptcha(html);
                vote.setCodeVote(code);
                model.addAttribute("captchaForm", vote);
                result.reject("form.problems");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.