From 0a637c5cb819f49597b9265bb1fcd505092f6fe0 Mon Sep 17 00:00:00 2001 From: Thomas Lynch Date: Wed, 8 Feb 2023 20:51:53 +1100 Subject: [PATCH] Fix url/redirect and locale handling for js blockbypass --- lib/middleware/captcha/blockbypass.js | 6 +++--- views/includes/head.pug | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/middleware/captcha/blockbypass.js b/lib/middleware/captcha/blockbypass.js index 523cfae0..79a9651d 100644 --- a/lib/middleware/captcha/blockbypass.js +++ b/lib/middleware/captcha/blockbypass.js @@ -12,7 +12,7 @@ module.exports = { check: async (req, res, next) => { - const { __ } = res.locals; + const { __, locale } = res.locals; const { secureCookies, blockBypass } = config.get; //bypass captcha permission @@ -28,7 +28,7 @@ module.exports = { return dynamicResponse(req, res, 403, 'message', { 'title': __('Forbidden'), 'message': __('Please complete a block bypass to continue'), - 'frame': '/bypass_minimal.html', + 'frame': `/bypass_minimal.html?language=${encodeURIComponent(locale)}`, 'link': { 'href': '/bypass.html', 'text': __('Get block bypass'), @@ -72,7 +72,7 @@ module.exports = { return dynamicResponse(req, res, 403, 'message', { 'title': __('Forbidden'), 'message': __('Block bypass expired or exceeded max uses'), - 'frame': '/bypass_minimal.html', + 'frame': `/bypass_minimal.html?language=${encodeURIComponent(locale)}`, 'link': { 'href': '/bypass.html', 'text': __('Get block bypass'), diff --git a/views/includes/head.pug b/views/includes/head.pug index 77655a7b..966aa2b7 100644 --- a/views/includes/head.pug +++ b/views/includes/head.pug @@ -33,7 +33,7 @@ if isBoard && board.settings.customCss include ../../gulp/res/icons/html_code.html //- language pack -- const languageScript = isBoard ? board.settings.language : globalLanguage; +- const languageScript = isBoard ? board.settings.language : (locale || globalLanguage); script(src=`/js/lang/${languageScript}.js?v=${commit}`) //- main script