Examples of Captcha


Examples of com.dotcms.repackage.nl.captcha.Captcha

   * @return boolean
   */
  public static boolean isValidAudioCaptcha(HttpServletRequest request){

    HttpSession session = request.getSession();
    Captcha captcha = (Captcha) session.getAttribute(Captcha.NAME);
        String captchaSession=captcha!=null ? captcha.getAnswer() : null;
    Boolean isResponseCorrect = Boolean.FALSE;
    String captchaId = request.getSession().getId()
    String audioCaptcha = request.getParameter("captcha");

    if(UtilMethods.isSet(audioCaptcha) && UtilMethods.isSet(captchaSession) && audioCaptcha.equals(captchaSession)){
View Full Code Here

Examples of com.dotcms.repackage.nl.captcha.Captcha

      useCaptcha = new Boolean(request.getParameter("useCaptcha")).booleanValue();
    }
   
    String captcha = request.getParameter("captcha");
    if (useCaptcha) {
        Captcha captchaObj = (Captcha) session.getAttribute(Captcha.NAME);
            String captchaSession=captchaObj!=null ? captchaObj.getAnswer() : null;
           
      if(captcha ==null && Config.getBooleanProperty("FORCE_CAPTCHA",true)){
        response.getWriter().write("Captcha is required to submit this form ( FORCE_CAPTCHA=true ).<br>To change this, edit the dotmarketing-config.properties and set FORCE_CAPTCHA=false");
        return null;
      }
View Full Code Here

Examples of com.dotcms.repackage.nl.captcha.Captcha

    ByteArrayOutputStream soundOutputStream = new ByteArrayOutputStream();
    AudioInputStream challenge = null;
    try {

      //String captchaSession =  (String) .getAttribute(com.dotcms.repackage.nl.captcha.servlet.Constants.SIMPLE_CAPCHA_SESSION_KEY);
      Captcha captcha = (Captcha) request.getSession().getAttribute(Captcha.NAME);
      String captchaSession=captcha!=null ? captcha.getAnswer() : null;
      if(UtilMethods.isSet(captchaSession)){
       
        /*If we have a normal captcha in the session we should generate the word in the session instead of using
          a custom sound challenge*/
        WordGenerator word = new DummyWordGenerator(captchaSession.trim());
View Full Code Here

Examples of com.dotcms.repackage.nl.captcha.Captcha

   */
  public static boolean isValidImageCaptcha(HttpServletRequest request){

    HttpSession session = request.getSession();
    String captcha = request.getParameter("captcha");
    Captcha captchaObj = (Captcha) session.getAttribute(Captcha.NAME);
        String captchaSession=captchaObj!=null ? captchaObj.getAnswer() : null;
    if(!UtilMethods.isSet(captcha) || !UtilMethods.isSet(captchaSession) || !captcha.equals(captchaSession)){
      return false;
    }
    return true;

View Full Code Here

Examples of com.dotcms.repackage.nl.captcha.Captcha

  {
    ContentletAPI conAPI = APILocator.getContentletAPI();
    ActionErrors errors = new ActionErrors();
    Contentlet parentContentlet = new Contentlet()
    HttpSession session = request.getSession();
        Captcha captchaSession = (Captcha) session.getAttribute(Captcha.NAME);

        try{
      parentContentlet = conAPI.find(contentInode, APILocator.getUserAPI().getSystemUser(), true);
    }catch(DotDataException e){
      Logger.error(this, "Unable to look up contentlet with inode " + contentInode, e);
    }catch (DotSecurityException dse) {
      Logger.error(this, "Unable to look up contentlet with inode " + contentInode + " because of security issue", dse);
    }
   
    if(parentContentlet==null || !InodeUtils.isSet(parentContentlet.getInode())){
      errors.add(ActionErrors.GLOBAL_ERROR, new ActionError("message.contentlet.required","Contentlet Inode"));       
      return errors;
    }
    if (!UtilMethods.isSet(name))
    {
      errors.add(ActionErrors.GLOBAL_ERROR, new ActionError("message.contentlet.required","Name"));       
    }
    if (!UtilMethods.isSet(email) || ! UtilMethods.isValidEmail(email))
    {       
      errors.add(ActionErrors.GLOBAL_ERROR, new ActionError("message.contentlet.required","Email"));       
    }
    /*  Try to find a title if we don't have one.  */
    if (!UtilMethods.isSet(commentTitle))
      {
      Structure s = StructureCache.getStructureByInode(parentContentlet.getStructureInode());
      List<Field> lf = s.getFields();
      for(Field f : lf){
        if("text".equals(f.getFieldType()) && f.isIndexed() && f.isListed()){
          try{
            commentTitle = "re: " + conAPI.getFieldValue(parentContentlet, f);
          }catch (Exception e) {
            Logger.error(CommentsForm.class, "Unable to set comment title", e);
          }
          break;
        }
      }
      }
    if (!UtilMethods.isSet(comment))
    {
      errors.add(ActionErrors.GLOBAL_ERROR, new ActionError("message.contentlet.required","Comment"));
    }
    if (UtilMethods.isSet(accept) && accept == false)
    {
      errors.add(ActionErrors.GLOBAL_ERROR, new ActionError("message.contentlet.required","Accept"));
    }

        if ( commentUseCaptcha ) {
            if ( !UtilMethods.isSet( captcha ) || !UtilMethods.isSet( captchaSession ) || !captcha.equals( captchaSession.getAnswer() ) ) {
                errors.add( ActionErrors.GLOBAL_ERROR, new ActionError( "message.contentlet.required", "Validation Image" ) );
            }
        }

        if(commentUseAudioCaptcha && !UtilMethods.isSet(captchaSession)){
View Full Code Here

Examples of com.github.jreddit.captcha.Captcha

     SubmitActions submitActions = new SubmitActions(restClient, user);

    try {
   
      // Captcha requester
      Captcha c = new Captcha(restClient);
     
      // Check if a captcha is needed for this user
      if (c.needsCaptcha(user)) {
       
        // Ask for a new Captcha identification
        String iden = c.newCaptcha(user);
       
        // Show the captcha to you
        showCaptcha(iden);
       
        // Ask for captcha solution
View Full Code Here

Examples of com.liferay.portal.kernel.captcha.Captcha

      @SuppressWarnings("unchecked")
      Class<Captcha> captchaClass = (Class<Captcha>) portalClassLoader.loadClass(captchaClassName);

      CaptchaUtil captchaUtil = new CaptchaUtil();
      Captcha captcha = captchaClass.newInstance();
      captchaUtil.setCaptcha(captcha);
      CaptchaUtil.serveImage(httpServletRequest, captchaHttpServletResponse);

      String captchaText = (String) httpServletRequest.getSession().getAttribute(CAPTCHA_TEXT);
      portletSession.setAttribute(CAPTCHA_TEXT, captchaText);
View Full Code Here

Examples of jj.play.ns.nl.captcha.Captcha

                150 + rand.nextInt(55)
        );

        char[] chars = new char[]{'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'};

        Captcha captcha = new Captcha.Builder(200, 50)
                .addText(
                        new TextProducer() {
                            @Override
                            public String getText() {
                                return Integer.toString(code);
                            }
                        },
                        new DefaultWordRenderer(textColor, textFonts))
                .addBackground(new FlatColorBackgroundProducer(backgroundColor))
                .gimp(new FishEyeGimpyRenderer(fishColor1, fishColor2))
                        //.addNoise()
                        //.addBorder()
                        .build();

        BufferedImage image = captcha.getImage();

        response.setContentType("image/jpeg");
        response.setHeader("Cache-Control", "no-cache, no-store");
        response.setHeader("Pragma", "no-cache");
        long time = System.currentTimeMillis();
View Full Code Here

Examples of nl.captcha.Captcha

   @Override
   public void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
   {
      HttpSession session = req.getSession();
      Captcha captcha;
      if (session.getAttribute(NAME) == null)
      {
         captcha = new Captcha.Builder(_width, _height).addText().gimp().addNoise().addBackground().build();

         session.setAttribute(NAME, captcha);
         CaptchaServletUtil.writeImage(resp, captcha.getImage());

         return;
      }

      captcha = (Captcha) session.getAttribute(NAME);
      CaptchaServletUtil.writeImage(resp, captcha.getImage());
   }
View Full Code Here

Examples of nl.captcha.Captcha

  /**
   * 取得验证码
   */
  public void getImg() throws Exception
  {
    Captcha captcha = (new nl.captcha.Captcha.Builder(200, 50)).addText().addBackground().addNoise().build();
    CaptchaServletUtil.writeImage(super.response, captcha.getImage());
    getSession().setAttribute("simpleCaptcha", captcha);
  }
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.