Move middleware to properly fix bypass success screen language, and update some code in gulp/res/js/forms.js to handle translated responses for e.g. missing captcha

indiachan-spamvector
Thomas Lynch 1 year ago
parent 0b99e89522
commit 89ee952eb6
  1. 2
      controllers/forms.js
  2. 4
      gulp/res/js/forms.js

@ -123,7 +123,7 @@ router.post('/deletesessions', useSession, sessionRefresh, csrf, calcPerms, isLo
//removes captcha cookie, for refreshing for noscript users //removes captcha cookie, for refreshing for noscript users
router.post('/newcaptcha', newCaptchaForm); router.post('/newcaptcha', newCaptchaForm);
//solve captcha for block bypass //solve captcha for block bypass
router.post('/blockbypass', geoIp, processIp, useSession, sessionRefresh, calcPerms, verifyCaptcha, setQueryLanguage, blockBypassForm); router.post('/blockbypass', geoIp, processIp, useSession, sessionRefresh, calcPerms, setQueryLanguage, verifyCaptcha, blockBypassForm);
module.exports = router; module.exports = router;

@ -334,12 +334,12 @@ class postFormHandler {
} else { } else {
//not a 200 so probably error //not a 200 so probably error
if (!this.captchaField && json.message === 'Incorrect captcha answer') { if (!this.captchaField && json.message === __('Incorrect captcha answer')) {
/* add missing captcha field if we got an error about it and the form has no captcha field /* add missing captcha field if we got an error about it and the form has no captcha field
(must have been enabeld after we loaded the page) */ (must have been enabeld after we loaded the page) */
captchaController.addMissingCaptcha(); captchaController.addMissingCaptcha();
this.captchaField = true; this.captchaField = true;
} else if (json.message === 'Captcha expired') { } else if (json.message === __('Captcha expired')) {
//if captcha is expired, just refresh the captcha //if captcha is expired, just refresh the captcha
const captcha = this.form.querySelector('.captcharefresh'); const captcha = this.form.querySelector('.captcharefresh');
if (captcha) { if (captcha) {

Loading…
Cancel
Save