feat: Added a translation key for “Password is too weak (#6614)

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Frank Elsinga <frank@elsinga.de>
This commit is contained in:
Cyril59310
2026-01-06 20:53:51 +00:00
committed by GitHub
co-authored by autofix-ci[bot] Frank Elsinga
parent 82c6b364af
commit fc832d0935
4 changed files with 81 additions and 21 deletions
+5 -2
View File
@@ -75,6 +75,7 @@ const gracefulShutdown = require("http-graceful-shutdown");
log.debug("server", "Importing prometheus-api-metrics");
const prometheusAPIMetrics = require("prometheus-api-metrics");
const { passwordStrength } = require("check-password-strength");
const TranslatableError = require("./translatable-error");
log.debug("server", "Importing 2FA Modules");
const notp = require("notp");
@@ -673,7 +674,7 @@ let needSetup = false;
socket.on("setup", async (username, password, callback) => {
try {
if (passwordStrength(password).value === "Too weak") {
throw new Error("Password is too weak. It should contain alphabetic and numeric characters. It must be at least 6 characters in length.");
throw new TranslatableError("passwordTooWeak");
}
if ((await R.knex("user").count("id as count").first()).count !== 0) {
@@ -697,6 +698,7 @@ let needSetup = false;
callback({
ok: false,
msg: e.message,
msgi18n: !!e.msgi18n,
});
}
});
@@ -1410,7 +1412,7 @@ let needSetup = false;
}
if (passwordStrength(password.newPassword).value === "Too weak") {
throw new Error("Password is too weak. It should contain alphabetic and numeric characters. It must be at least 6 characters in length.");
throw new TranslatableError("passwordTooWeak");
}
let user = await doubleCheckPassword(socket, password.currentPassword);
@@ -1429,6 +1431,7 @@ let needSetup = false;
callback({
ok: false,
msg: e.message,
msgi18n: !!e.msgi18n,
});
}
});