whbah / kaptcha

Automatically exported from code.google.com/p/kaptcha
Other
0 stars 0 forks source link

session key is previous image - don't think it is KAPTCHA; looking for direction #60

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What version of the product are you using? On what operating system?
Using 2.3.2, IE6 on XP

Please provide any additional information below.

I know this is probably not the place to post this, but see nowhere else, so 
forgive.

I don't believe it is Kaptcha, but I must be doing something wrong and can't 
figure it out.  I am trying to store the SESSION_KEY in a hidden JSP field so 
that my Javascript code can retrieve the values and do the compare test.  
However, the hidden field being used is NULL on first pass and after form 
refreshes, always contains the previous image text.

I am doing this in JSP:

<tr>
  <td>
     <img src="kaptcha.jpg" onClick="document.location.reload();" /> 
     <% hiddenKaptchaKey = (String)session.getAttribute(com.google.code.kaptcha.Constants.KAPTCHA_SESSION_KEY); %>
     <input type="hidden" name="kaptchaHidden" id="kaptchaHidden" value="<%=hiddenKaptchaKey%>" />                                                     
     <input class="gtclear" valign="bottom" type="text" size="5" maxlength="5" name="kaptchafield" id="kaptchafield" value="" autocomplete="off" />
  </td>
</tr>                

then in external .js file:

kapReceive = f.kaptchafield.value;
kapExpect = f.kaptchaHidden.value;

alert ('kapR: ' + kapReceive);
alert ('kapE: ' + kapExpect);

the receive is always correct, but the expect is always the previous image.  I 
have strong suspicion I am doing something wrong, but not sure what.  Any help 
would be much appreciated.  Fairly new to JSP.

Original issue reported on code.google.com by marf...@gmail.com on 21 Apr 2011 at 4:28

GoogleCodeExporter commented 9 years ago

Original comment by latch...@gmail.com on 2 Sep 2011 at 5:25