forked from leftypol/leftypol
Add automatic and manual reloading of captchas
This commit is contained in:
parent
11bab0a9ad
commit
f0b3c0fcb6
4 changed files with 15 additions and 3 deletions
|
@ -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');
|
||||
|
||||
|
|
|
@ -102,8 +102,8 @@
|
|||
Captcha
|
||||
</th>
|
||||
<td>
|
||||
<img src="{{ config.root }}/captcha.php"><br />
|
||||
<input type="text" name="captcha" size="25" maxlength="10" autocomplete="off">
|
||||
<img name="captcha-img" id="captcha-img" src="/captcha.php" onClick="this.src='/captcha.php?'+Date.now();document.getElementById('captcha').value = '';"><br />
|
||||
<input type="text" name="captcha" id="captcha" size="25" maxlength="10" autocomplete="off">
|
||||
</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue