Package com.dotcms.repackage.nl.captcha

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


   * @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

      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

    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

   */
  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

  {
    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

TOP

Related Classes of com.dotcms.repackage.nl.captcha.Captcha

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.