From 89ee952eb6de287b32dd240d87e61aa7cbca8028 Mon Sep 17 00:00:00 2001 From: Thomas Lynch Date: Tue, 11 Apr 2023 18:52:14 +1000 Subject: [PATCH] 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 --- controllers/forms.js | 2 +- gulp/res/js/forms.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/controllers/forms.js b/controllers/forms.js index 046f30b3..62ada4c9 100644 --- a/controllers/forms.js +++ b/controllers/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; diff --git a/gulp/res/js/forms.js b/gulp/res/js/forms.js index d86b0b05..30eb045f 100644 --- a/gulp/res/js/forms.js +++ b/gulp/res/js/forms.js @@ -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) {