diff --git a/inc/config.php b/inc/config.php index a76d00de..1444c61b 100644 --- a/inc/config.php +++ b/inc/config.php @@ -1786,7 +1786,7 @@ $config['error']['securimage']=array( 'missing'=>'The captcha field was missing. Please try again', 'empty'=>'Please fill out the captcha', - 'bad'=>'Incorrect captcha', + 'bad'=>'Incorrect or expired captcha', ); // Meta keywords. It's probably best to include these in per-board configurations. diff --git a/js/ajax.js b/js/ajax.js index c312c130..01de3b08 100644 --- a/js/ajax.js +++ b/js/ajax.js @@ -56,6 +56,7 @@ $(window).ready(function() { return xhr; }, success: function(post_response) { + reloadCaptcha(); // For securimage captcha. TODO doesn't always need reloading if (post_response.error) { if (post_response.banned) { // You are banned. Must post the form normally so the user can see the ban message. diff --git a/templates/main.js b/templates/main.js index af665987..024b748e 100755 --- a/templates/main.js +++ b/templates/main.js @@ -286,6 +286,17 @@ function dopost(form) { return form.elements['body'].value != "" || (form.elements['file'] && form.elements['file'].value != "") || (form.elements.file_url && form.elements['file_url'].value != ""); } +function reloadCaptcha() { + // Reload captcha images (date reduces chance of caching) + // If no securimage captcha is enabled, no elements will be found + captchaImgs = document.querySelectorAll('[id=captcha-img]'); + for (var i = 0; i < captchaImgs.length; ++i) + captchaImgs[i].src = "/captcha.php?"+Date.now(); + captchas = document.querySelectorAll('[id=captcha]'); + for (var i = 0; i < captchas.length; ++i) + captchas[i].value = ""; +} + function citeReply(id, with_link) { var textarea = document.getElementById('body'); diff --git a/templates/post_form.html b/templates/post_form.html index 63ace217..e8c14485 100644 --- a/templates/post_form.html +++ b/templates/post_form.html @@ -102,8 +102,8 @@ Captcha -
- +
+ {% endif %}