clear captcha on submit

This commit is contained in:
James Campos 2010-10-12 03:24:57 -07:00
parent 4ce27d6e0a
commit 4e08b75895
2 changed files with 10 additions and 8 deletions

View File

@ -426,6 +426,7 @@ iframeLoad = ->
qr.appendChild(span) qr.appendChild(span)
else if REPLY and getConfig('Persistent QR') else if REPLY and getConfig('Persistent QR')
$('textarea', qr).value = '' $('textarea', qr).value = ''
$('input[name=recaptcha_response_field]', qr).value = ''
else else
remove qr remove qr
@ -435,8 +436,10 @@ iframeLoad = ->
submit = (e) -> submit = (e) ->
if span = @nextSibling if span = @nextSibling
remove(span) remove(span)
recaptcha = $('#recaptcha_response_field', this) recaptcha = $('input[name=recaptcha_response_field]', this)
if not recaptcha.value if recaptcha.value
$('#qr input[title=autohide]:not(:checked)')?.click()
else
e.preventDefault() e.preventDefault()
span = n 'span', { span = n 'span', {
className: 'error' className: 'error'
@ -445,8 +448,6 @@ submit = (e) ->
@parentNode.appendChild span @parentNode.appendChild span
alert 'You forgot to type in the verification.' alert 'You forgot to type in the verification.'
recaptcha.focus() recaptcha.focus()
else
$('#qr input[title=autohide]:not(:checked)')?.click()
autohide = -> autohide = ->

View File

@ -466,6 +466,7 @@
qr.appendChild(span); qr.appendChild(span);
} else if (REPLY && getConfig('Persistent QR')) { } else if (REPLY && getConfig('Persistent QR')) {
$('textarea', qr).value = ''; $('textarea', qr).value = '';
$('input[name=recaptcha_response_field]', qr).value = '';
} else { } else {
remove(qr); remove(qr);
} }
@ -476,8 +477,10 @@
if (span = this.nextSibling) { if (span = this.nextSibling) {
remove(span); remove(span);
} }
recaptcha = $('#recaptcha_response_field', this); recaptcha = $('input[name=recaptcha_response_field]', this);
if (!recaptcha.value) { if (recaptcha.value) {
return (typeof (_ref3 = ((_ref2 = $('#qr input[title=autohide]:not(:checked)')))) === "undefined" || _ref3 === null) ? undefined : _ref3.click();
} else {
e.preventDefault(); e.preventDefault();
span = n('span', { span = n('span', {
className: 'error', className: 'error',
@ -486,8 +489,6 @@
this.parentNode.appendChild(span); this.parentNode.appendChild(span);
alert('You forgot to type in the verification.'); alert('You forgot to type in the verification.');
return recaptcha.focus(); return recaptcha.focus();
} else {
return (typeof (_ref3 = ((_ref2 = $('#qr input[title=autohide]:not(:checked)')))) === "undefined" || _ref3 === null) ? undefined : _ref3.click();
} }
}; };
autohide = function() { autohide = function() {