check dummy if nothing cached

This commit is contained in:
James Campos 2011-08-24 07:54:05 -07:00
parent 3022c02e51
commit e33bec4cfe
2 changed files with 19 additions and 5 deletions

View File

@ -1323,7 +1323,6 @@
},
message: function(e) {
var data, duration, fileCount;
Recaptcha.reload();
$('iframe[name=iframe]').src = 'about:blank';
fileCount = $('#files', qr.el).childElementCount;
data = e.data;
@ -1363,7 +1362,7 @@
return $.bind(quote, 'click', qr.quote);
},
postInvalid: function() {
var captcha, captchas, content, cutoff;
var captcha, captchas, content, cutoff, dummy, response;
content = $('textarea', qr.el).value || $('input[type=file]', qr.el).files.length;
if (!content) {
return 'Error: No text entered.';
@ -1382,7 +1381,16 @@
$.set('captchas', captchas);
$('#captchas', qr.el).textContent = captchas.length + ' captchas';
if (!captcha) {
return 'You forgot to type in the verification.';
dummy = $('#dummy', qr.el);
if (!(response = dummy.value)) {
return 'You forgot to type in the verification';
}
captcha = {
challenge: qr.challenge,
response: response
};
dummy.value = '';
Recaptcha.reload();
}
$('#recaptcha_challenge_field', qr.el).value = captcha.challenge;
$('#recaptcha_response_field', qr.el).value = captcha.response;

View File

@ -1076,7 +1076,6 @@ qr =
$.append d.body, qr.el
message: (e) ->
Recaptcha.reload()
$('iframe[name=iframe]').src = 'about:blank'
fileCount = $('#files', qr.el).childElementCount
@ -1128,7 +1127,14 @@ qr =
$('#captchas', qr.el).textContent = captchas.length + ' captchas'
return 'You forgot to type in the verification.' unless captcha
unless captcha
dummy = $ '#dummy', qr.el
return 'You forgot to type in the verification' unless response = dummy.value
captcha =
challenge: qr.challenge
response: response
dummy.value = ''
Recaptcha.reload()
$('#recaptcha_challenge_field', qr.el).value = captcha.challenge
$('#recaptcha_response_field', qr.el).value = captcha.response