mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-05-19 21:52:35 +02:00
fix: Check password strength when resetting the password in CLI (#5788)
This commit is contained in:
parent
8d8e3e5a8e
commit
999132aca8
1 changed files with 8 additions and 0 deletions
|
@ -3,6 +3,7 @@ console.log("== Uptime Kuma Reset Password Tool ==");
|
||||||
const Database = require("../server/database");
|
const Database = require("../server/database");
|
||||||
const { R } = require("redbean-node");
|
const { R } = require("redbean-node");
|
||||||
const readline = require("readline");
|
const readline = require("readline");
|
||||||
|
const { passwordStrength } = require("check-password-strength");
|
||||||
const { initJWTSecret } = require("../server/util-server");
|
const { initJWTSecret } = require("../server/util-server");
|
||||||
const User = require("../server/model/user");
|
const User = require("../server/model/user");
|
||||||
const { io } = require("socket.io-client");
|
const { io } = require("socket.io-client");
|
||||||
|
@ -42,8 +43,15 @@ const main = async () => {
|
||||||
console.log("Using password from argument");
|
console.log("Using password from argument");
|
||||||
console.warn("\x1b[31m%s\x1b[0m", "Warning: the password might be stored, in plain text, in your shell's history");
|
console.warn("\x1b[31m%s\x1b[0m", "Warning: the password might be stored, in plain text, in your shell's history");
|
||||||
password = confirmPassword = args["new-password"] + "";
|
password = confirmPassword = args["new-password"] + "";
|
||||||
|
if (passwordStrength(password).value === "Too weak") {
|
||||||
|
throw new Error("Password is too weak, please use a stronger password.");
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
password = await question("New Password: ");
|
password = await question("New Password: ");
|
||||||
|
if (passwordStrength(password).value === "Too weak") {
|
||||||
|
console.log("Password is too weak, please try again.");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
confirmPassword = await question("Confirm New Password: ");
|
confirmPassword = await question("Confirm New Password: ");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue