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? 

  • How to find generated captcha value?
    2014/01/20 20:32

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

  • Number of messages  3
    Registration date Jan 20, 2014
    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.

     

  • Re : Re: How to find generated captcha value?
    2014/01/21 09:52

    chessgirl <p> Yes, I saw the form action validation documentation. I&#39;m using &lt;template:tokenizedForm&gt;. The problem is that if I enter wrong captcha, the form still passes.</p> <p> &nbsp;</p>

  • Number of messages  3
    Registration date Jan 21, 2014
    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?
     
  • Re : Re : Re : Re: How to find generated captcha value?
    2014/01/22 15:25

    chessgirl <p> Yes, I tried that too. Problem is, if I enter symboles different from these on the image, the &nbsp;form still passes. So how Jahia validates that? Or how I can validate it myself?</p> <p> Here&#39;s that part of my code:</p> <blockquote> <div> &lt;c:if test=&quot;${not renderContext.loggedIn}&quot;&gt;</div> <div> <span style="font-size: 12px;">&lt;div </span><span style="font-size: 12px;">class=&quot;conteneurFormulaire&quot; id=&quot;captcha&quot;&gt;</span></div> <div> <span style="font-size: 12px;">&lt;h4 class=&quot;titreFrm&quot; style=&quot;color: #00b9e4&quot;&gt;</span></div> </blockquote> <blockquote> <div> &lt;label for=&quot;captcha&quot;&gt;Captcha &lt;span</div> <div> class=&quot;mandatoryStarInline&quot;&gt;*&lt;/span&gt;</div> <div> &lt;/label&gt;</div> <div> &lt;/h4&gt;</div> <div> &lt;h3&gt;TEST&lt;/h3&gt;&nbsp;</div> <div> &lt;div class=&quot;conteneurForm&quot;&gt;</div> <div> &lt;div class=&quot;ligneFormulaire&quot;&gt;</div> <div> &lt;div class=&quot;libForm&quot;&gt;&lt;/div&gt;</div> <div> &lt;div class=&quot;valForm&quot;&gt;</div> <div> &lt;template:captcha /&gt;</div> <div> &lt;br /&gt; &lt;br /&gt; &lt;input class=&quot;champFrm&quot; type=&quot;text&quot; id=&quot;captcha&quot;</div> <div> name=&quot;captcha&quot; /&gt;</div> <div> &lt;/div&gt;</div> <div> &lt;/div&gt;</div> <div> &lt;/div&gt;</div> <div> &lt;/div&gt;</div> <div> &lt;div class=&quot;breaker&quot;&gt;&lt;/div&gt;</div> </blockquote> <div> &lt;/c:if&gt;</div> <div> &nbsp;</div> <div> and the java script rule</div> <div> &nbsp;</div> <div> captcha: {required : true}</div> <div> &nbsp;</div> <div> So, do I need to write something else in the rule?</div> <div> &nbsp;</div>

  • Number of messages  3
    Registration date Jan 22, 2014
    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