tel8618217223380 / prado3

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

TReCaptcha does not work well with active controls #431

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Modify the attached testcase and supply a valid recaptcha API keyset in it 
2. Run the test case 
3. Try clicking the buttons 
4. Observe the results

What is the expected output? What do you see instead?
The ReCaptcha control should appear, disappear and validate the input 
regardless whether it's shown, hidden or validate from a regular or from an 
active control. However, that's not the case, and the recaptcha control does 
not appear always correctly if was made visible first in a callback. Recaptcha 
validation also behaves buggy when the solution supplied by the user is 
evaluated in a callback of an active control, and not from a regular postback.

What version of the product are you using? On what operating system?
Prado/3.2.0/trunk

Please provide any additional information below.
An updated version of the TReCaptcha and TReCaptchaValidator controls are 
attached, which behave now correctly regardless whether they're used in regular 
postbacks or callbacks.

Needs r3195 applied to stock 3.2, otherwise validation will not work as 
expected!

Original issue reported on code.google.com by google...@pcforum.hu on 5 Jan 2013 at 12:54

Attachments:

GoogleCodeExporter commented 9 years ago
Committed the new version as r3236 (branch 3.2), r3237 (trunk/)

Original comment by ctrlal...@gmail.com on 6 Jan 2013 at 6:19

GoogleCodeExporter commented 9 years ago
I've encountered a small bug which surfaces if the application code calls 
TReCaptcha::regenerateToken() in a callback on a freshly shown or created 
TReCaptcha control. If this happens the recaptcha ajax library throws a 
"ReCaptchaState is undefined" exception (which seems to be a bug in the library 
itself, according to several posts in support forums), and fails to render the 
captcha control.

To avoid this I've patched the TReCaptcha control to check for the existence of 
said ReCaptchaState variable on the client side, and if it's not present, it 
will simply skip the call to the token regenerator method. This shouldn't be a 
problem as if ReCaptchaState is not defined then there was no captcha control 
on the page previously, and thus a new captcha with a fresh token-challenge 
pair will be created/loaded anyway.

Original comment by google...@pcforum.hu on 7 Jan 2013 at 5:17

Attachments:

GoogleCodeExporter commented 9 years ago
Committed as r3243, thank you.

Original comment by ctrlal...@gmail.com on 7 Jan 2013 at 3:45