Start the QR by reloading the captcha to avoid browser cached captchas.

This commit is contained in:
Nicolas Stepien 2012-02-16 15:49:59 +01:00
parent d8752b7925
commit 916a98d089
3 changed files with 8 additions and 6 deletions

View File

@ -1247,6 +1247,7 @@
if (this.src !== 'about:blank') return setTimeout(loadChecking, 500, this);
});
$.add(d.body, iframe);
window.location = 'javascript:void(Recaptcha.focus_response_field=function(){})';
if (conf['Persistent QR']) {
qr.dialog();
if (conf['Auto Hide QR']) qr.hide();
@ -1254,8 +1255,7 @@
$.on(d, 'dragover', qr.dragOver);
$.on(d, 'drop', qr.dropFile);
$.on(d, 'dragstart', qr.drag);
$.on(d, 'dragend', qr.drag);
return window.location = 'javascript:void(Recaptcha.focus_response_field=function(){})';
return $.on(d, 'dragend', qr.drag);
},
node: function(root) {
return $.on($('.quotejs + .quotejs', root), 'click', qr.quote);
@ -1588,7 +1588,7 @@
return _this.count(arr.length);
});
this.count($.get('captchas', []).length);
return this.load();
return this.reload();
},
save: function() {
var captcha, captchas, response;

View File

@ -1,5 +1,6 @@
master
- Mayhem
Ensure fresh captcha on QR load.
Fix unXXXifier on pages starting with not XXXed numbers.
Update image limit notifier for /vg/.

View File

@ -912,6 +912,8 @@ qr =
$.on iframe, 'load', -> unless @src is 'about:blank' then setTimeout loadChecking, 500, @
$.add d.body, iframe
# Prevent original captcha input from being focused on reload.
window.location = 'javascript:void(Recaptcha.focus_response_field=function(){})'
if conf['Persistent QR']
qr.dialog()
qr.hide() if conf['Auto Hide QR']
@ -919,8 +921,6 @@ qr =
$.on d, 'drop', qr.dropFile
$.on d, 'dragstart', qr.drag
$.on d, 'dragend', qr.drag
# prevent original captcha input from being focused on reload
window.location = 'javascript:void(Recaptcha.focus_response_field=function(){})'
node: (root) ->
$.on $('.quotejs + .quotejs', root), 'click', qr.quote
@ -1187,7 +1187,8 @@ qr =
$.on @challenge, 'DOMNodeInserted', => @load()
$.sync 'captchas', (arr) => @count arr.length
@count $.get('captchas', []).length
@load()
# start with an uncached captcha
@reload()
save: ->
return unless response = @input.value
captchas = $.get 'captchas', []