Jahia Dev Forum > How to find generated...

0 (0 Good)
0 (0 Bad)

How to find generated captcha value?

by  chessgirl »  2014/01/20 20:32

Hello,

I'm trying to integrate a captcha in a contact form. I used the <template:captcha/> and from client-side everything is fine. But if I enter a value different from that displayed on the image ( wrong captcha),  the form is still passing. So how can i find the value, generated by Jahia to check? And how Jahia validates the captcha? 

  (chessgirl)

Number of messages  3
Registration date
0 (0 Good)
0 (0 Bad)

Re: How to find generated captcha value?

by  rvt »  2014/01/21 02:38

Hey,

did you take a look here? http://www.jahia.com/community/documentation/actions/validation.html

jahia should take care of this without you (the developer) needing to test for this.

I am guessing you might be missing : <template:tokenizedForm>

  • Re: How to find generated captcha value?
    2014/01/21 02:38

    rvt <p> Hey,</p> <p> did you take a look here?&nbsp;<a href="http://www.jahia.com/community/documentation/actions/validation.html">http://www.jahia.com/community/documentation/actions/validation.html</a></p> <p> jahia should take care of this without you (the developer) needing to test for this.</p> <p> I am guessing you might be missing :&nbsp;<span style="color: rgb(51, 51, 51); font-size: 13px;">&lt;template:tokenizedForm&gt;</span></p>

  • Number of messages  185
    Registration date Jan 21, 2014
    0 (0 Good)
    0 (0 Bad)

    Re : Re: How to find generated captcha value?

    by  chessgirl »  2014/01/21 09:52

    Yes, I saw the form action validation documentation. I'm using <template:tokenizedForm>. The problem is that if I enter wrong captcha, the form still passes.

     

      (chessgirl)

    Number of messages  3
    Registration date
    0 (0 Good)
    0 (0 Bad)

    Re : Re : Re: How to find generated captcha value?

    by  shuber »  2014/01/22 09:03

    Are you logged in when testing the captcha. I think that when you are logged in the captcha always passes, as it is only really checked when an anonymous user tries to submit a form. For example in our comments system we only display the captcha for non-logged in users.

    Best regards,

      Serge Huber.

    Serge Huber (shuber)

    Number of messages  271
    Registration date
    0 (0 Good)
    0 (0 Bad)

    Re : Re : Re : Re: How to find generated captcha value?

    by  chessgirl »  2014/01/22 15:20

    Yes, I tried that too. Problem is, if I enter symboles different from these on the image, the  form still passes. So how Jahia validates that? Or how I can validate it myself?

    Here's that part of my code:

    <c:if test="${not renderContext.loggedIn}">
    <div class="conteneurFormulaire" id="captcha">
    <h4 class="titreFrm" style="color: #00b9e4">
    <label for="captcha">Captcha <span
    class="mandatoryStarInline">*</span>
    </label>
    </h4>
    <h3>TEST</h3> 
    <div class="conteneurForm">
    <div class="ligneFormulaire">
    <div class="libForm"></div>
    <div class="valForm">
    <template:captcha />
    <br /> <br /> <input class="champFrm" type="text" id="captcha"
    name="captcha" />
    </div>
    </div>
    </div>
    </div>
    <div class="breaker"></div>
    </c:if>
     
    and the java script rule
     
    captcha: {required : true}
     
    So, do I need to write something else in the rule?
     

      (chessgirl)

    Number of messages  3
    Registration date
    0 (0 Good)
    0 (0 Bad)

    Re: Re : Re: How to find generated captcha value?

    by  dgriffon »  2014/02/20 09:58

    Hello,

    There is a mistake in the documentation and we will fix it.

    In order to make the captcha work, the name of the field that receive the captcha entry must be named jcrCaptcha :

     <input class="champFrm" type="text" id="captcha"
    name="jcrCaptcha" />

    Here you can find an example of the captcha implementation :

    https://github.com/Jahia/contact/blob/1_3/src/main/webapp/jnt_contactForm/html/contactForm.jsp

    best regards,

    David

    David Griffon (dgriffon)

    Number of messages  76
    Registration date
    Contact
    Share
    Feedback

    Get in touch

    Whether you are a current user or if you are just evaluating Jahia, we are here to help.

    Contact us

    Share this page