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
router.post('/newcaptcha', newCaptchaForm);
//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;

@ -334,12 +334,12 @@ class postFormHandler {
} else {
//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
(must have been enabeld after we loaded the page) */
captchaController.addMissingCaptcha();
this.captchaField = true;
} else if (json.message === 'Captcha expired') {
} else if (json.message === __('Captcha expired')) {
//if captcha is expired, just refresh the captcha
const captcha = this.form.querySelector('.captcharefresh');
if (captcha) {

Loading…
Cancel
Save