From e35b0a869fc18fb6ed28e968cd2840d1d58955f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Tue, 11 Oct 2022 20:30:54 -0400 Subject: [PATCH] fix: https://github.com/NodeBB/NodeBB/issues/10525 --- src/install.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/install.js b/src/install.js index 97e981d071..ba0f13e7be 100644 --- a/src/install.js +++ b/src/install.js @@ -342,6 +342,14 @@ async function createAdmin() { try { User.isPasswordValid(results.password); } catch (err) { + const [namespace, key] = err.message.slice(2, -2).split(':', 2); + if (namespace && key && err.message.startsWith('[[') && err.message.endsWith(']]')) { + const lang = require(path.join(__dirname, `../public/language/en-GB/${namespace}`)); + if (lang && lang[key]) { + err.message = lang[key]; + } + } + winston.warn(`Password error, please try again. ${err.message}`); return await retryPassword(results); }