Package net.tanesha.recaptcha

Examples of net.tanesha.recaptcha.ReCaptchaImpl.checkAnswer()


   the given challenge.
   */
  public static boolean isCaptchaValid(String aIpAddress, String aChallenge, String aResponse){
    ReCaptchaImpl reCaptcha = new ReCaptchaImpl();
    reCaptcha.setPrivateKey(fPrivateKey);
    ReCaptchaResponse reCaptchaResponse =  reCaptcha.checkAnswer(
      aIpAddress, aChallenge, aResponse
    );
    return reCaptchaResponse.isValid();
  }
 
View Full Code Here


          errors.add("recaptchaUserResponse", new ActionMessage("content.error.captcha.required"));
        }
        else {
              ReCaptchaImpl reCaptcha = new ReCaptchaImpl();
              reCaptcha.setPrivateKey(captchaPrivateKey);
              ReCaptchaResponse reCaptchaResponse = reCaptcha.checkAnswer(remoteAddr, challenge, uresponse);
              if (!reCaptchaResponse.isValid())
                errors.add("recaptchaUserResponse", new ActionMessage(reCaptchaResponse.getErrorMessage(), false));
        }
    }
      return errors;
View Full Code Here

          errors.add("recaptchaUserResponse", new ActionMessage("content.error.captcha.required"));
        }
        else {
              ReCaptchaImpl reCaptcha = new ReCaptchaImpl();
              reCaptcha.setPrivateKey(captchaPrivateKey);
              ReCaptchaResponse reCaptchaResponse = reCaptcha.checkAnswer(remoteAddr, challenge, uresponse);
              if (!reCaptchaResponse.isValid())
                errors.add("recaptchaUserResponse", new ActionMessage(reCaptchaResponse.getErrorMessage(), false));
        }
    }
      return errors;
View Full Code Here

        ReCaptchaImpl reCaptcha = new ReCaptchaImpl();
        reCaptcha.setPrivateKey(PRIVATE_KEY);

        String challenge = request.getParameter("recaptcha_challenge_field");
        String uresponse = request.getParameter("recaptcha_response_field");
        ReCaptchaResponse reCaptchaResponse = reCaptcha.checkAnswer(remoteAddr, challenge, uresponse);
       
        return reCaptchaResponse.isValid();
    }

}
View Full Code Here

      String remoteAddr = req.getRemoteAddr();
      ReCaptchaImpl reCaptcha = new ReCaptchaImpl();
      reCaptcha.setPrivateKey("6LfUNtESAAAAANSiC1e3dD974bMUFY21S5QANakS");
      String challenge = req.getParameter("recaptcha_challenge_field");
      String uresponse = req.getParameter("recaptcha_response_field");
      ReCaptchaResponse reCaptchaResponse = reCaptcha.checkAnswer(
          remoteAddr, challenge, uresponse);

      if (!reCaptchaResponse.isValid()) {
        check.put("capcha", "Please enter exactly what you see.");
      }
View Full Code Here

           reCaptcha.setPrivateKey(privateKey);

           String challenge = request.getParameter("recaptcha_challenge_field");
           String uresponse = request.getParameter("recaptcha_response_field");
          
           ReCaptchaResponse reCaptchaResponse = reCaptcha.checkAnswer(remoteAddr, challenge, uresponse);

           return reCaptchaResponse.isValid();
     }

}
View Full Code Here

        */
        ReCaptchaImpl reCaptcha = new ReCaptchaImpl();
          reCaptcha.setPrivateKey(PRIVATE_KEY);
         
          ReCaptchaResponse reCaptchaResponse =
              reCaptcha.checkAnswer(remoteIp, challenge, response);
         
          if (!reCaptchaResponse.isValid()) {
              setError(FIELD_RESPONSE, "Please try again." + reCaptchaResponse.getErrorMessage());
              log.warning(FIELD_RESPONSE + " " + "Please try again." + reCaptchaResponse.getErrorMessage());
          }  
View Full Code Here

    ReCaptchaImpl reCaptcha = new ReCaptchaImpl();
    reCaptcha.setPrivateKey("6LcOO-kSAAAAAM2wCrSSw-0bB-cWMfTxH5YxGUIs");

    String challenge = req.getParameter("recaptcha_challenge_field");
    String uresponse = req.getParameter("recaptcha_response_field");
    ReCaptchaResponse reCaptchaResponse = reCaptcha.checkAnswer(remoteAddr, challenge, uresponse);

    System.out.println(role);
    if(!role.equals("empty") && reCaptchaResponse.isValid()){
      return new ModelAndView("LoginSuccess");
    }else{
View Full Code Here

    public boolean isSuccessful(String challenge, String response) {
        ReCaptchaImpl reCaptcha = new ReCaptchaImpl();
        reCaptcha.setPrivateKey(PRIVATE_KEY);

        ReCaptchaResponse reCaptchaResponse = reCaptcha.checkAnswer(CAPTCHA_URL, challenge, response);
        if(reCaptchaResponse.isValid()) {
            return true;
        }
        else {
            return false;
View Full Code Here

    if (this.getRecaptchaAfterEnabled()) {
      String remoteAddr = ServletActionContext.getRequest().getRemoteAddr();
      ReCaptchaImpl reCaptcha = new ReCaptchaImpl();
      String privateKey = this.getConfigManager().getParam(JpwebdynamicformSystemConstants.RECAPTCHA_PRIVATEKEY_PARAM_NAME);
      reCaptcha.setPrivateKey(privateKey);
      ReCaptchaResponse reCaptchaResponse = reCaptcha.checkAnswer(remoteAddr,
          this.getRecaptcha_challenge_field(), this.getRecaptcha_response_field());
      if (!reCaptchaResponse.isValid()) {
        this.addFieldError("recaptcha_response_field", this.getText("Errors.webdynamicform.captcha.notValid"));
      }
    }
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.