Prepare to start some cooldown when an incorrect captcha was input to avoid autoban.

Remove redundant "Error:".
This commit is contained in:
Nicolas Stepien 2012-01-24 21:25:16 +01:00
parent de4c34746c
commit 6bc0fb18d9
2 changed files with 7 additions and 9 deletions

View File

@ -1560,7 +1560,7 @@
}); });
reply = qr.replies[0]; reply = qr.replies[0];
if (!(reply.com || reply.file)) { if (!(reply.com || reply.file)) {
err = 'Error: No file selected.'; err = 'No file selected.';
} else { } else {
captchas = $.get('captchas', []); captchas = $.get('captchas', []);
while ((captcha = captchas[0]) && captcha.time < Date.now()) { while ((captcha = captchas[0]) && captcha.time < Date.now()) {
@ -1575,7 +1575,7 @@
} }
$.set('captchas', captchas); $.set('captchas', captchas);
qr.captcha.count(captchas.length); qr.captcha.count(captchas.length);
if (!response) err = 'Error: No valid captcha.'; if (!response) err = 'No valid captcha.';
} }
if (err) { if (err) {
qr.error(err); qr.error(err);
@ -1628,8 +1628,7 @@
} else if (b.childElementCount) { } else if (b.childElementCount) {
if (b.firstChild.tagName) node = b.firstChild; if (b.firstChild.tagName) node = b.firstChild;
err = b.firstChild.textContent; err = b.firstChild.textContent;
log(b); if (err === 'You seem to have mistyped the verification.') {}
console.dir(b);
} }
if (err) { if (err) {
qr.error(err, node); qr.error(err, node);

View File

@ -1157,7 +1157,7 @@ qr =
# prevent errors # prevent errors
unless reply.com or reply.file unless reply.com or reply.file
err = 'Error: No file selected.' err = 'No file selected.'
else else
# get oldest valid captcha # get oldest valid captcha
captchas = $.get 'captchas', [] captchas = $.get 'captchas', []
@ -1173,7 +1173,7 @@ qr =
$.set 'captchas', captchas $.set 'captchas', captchas
qr.captcha.count captchas.length qr.captcha.count captchas.length
unless response unless response
err = 'Error: No valid captcha.' err = 'No valid captcha.'
# more error prevention ? # more error prevention ?
if err if err
@ -1226,9 +1226,8 @@ qr =
else if b.childElementCount # error! else if b.childElementCount # error!
node = b.firstChild if b.firstChild.tagName # duplicate image link node = b.firstChild if b.firstChild.tagName # duplicate image link
err = b.firstChild.textContent err = b.firstChild.textContent
log b if err is 'You seem to have mistyped the verification.'
console.dir b ;# cooldown to prevent autoban
# error handling
if err if err
qr.error err, node qr.error err, node