|
|
@ -12,13 +12,15 @@ const rl = readline.createInterface({ |
|
|
|
output: process.stdout |
|
|
|
}); |
|
|
|
|
|
|
|
(async () => { |
|
|
|
const main = async () => { |
|
|
|
Database.init(args); |
|
|
|
await Database.connect(); |
|
|
|
|
|
|
|
try { |
|
|
|
const user = await R.findOne("user"); |
|
|
|
|
|
|
|
// No need to actually reset the password for testing, just make sure no connection problem. It is ok for now.
|
|
|
|
if (!process.env.TEST_BACKEND) { |
|
|
|
if (! user) { |
|
|
|
throw new Error("user not found, have you installed?"); |
|
|
|
} |
|
|
@ -35,27 +37,35 @@ const rl = readline.createInterface({ |
|
|
|
// Reset all sessions by reset jwt secret
|
|
|
|
await initJWTSecret(); |
|
|
|
|
|
|
|
rl.close(); |
|
|
|
break; |
|
|
|
} else { |
|
|
|
console.log("Passwords do not match, please try again."); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
console.log("Password reset successfully."); |
|
|
|
} |
|
|
|
} catch (e) { |
|
|
|
console.error("Error: " + e.message); |
|
|
|
} |
|
|
|
|
|
|
|
await Database.close(); |
|
|
|
rl.close(); |
|
|
|
|
|
|
|
console.log("Finished. You should restart the Uptime Kuma server.") |
|
|
|
})(); |
|
|
|
console.log("Finished."); |
|
|
|
}; |
|
|
|
|
|
|
|
function question(question) { |
|
|
|
return new Promise((resolve) => { |
|
|
|
rl.question(question, (answer) => { |
|
|
|
resolve(answer); |
|
|
|
}) |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
if (!process.env.TEST_BACKEND) { |
|
|
|
main(); |
|
|
|
} |
|
|
|
|
|
|
|
module.exports = { |
|
|
|
main, |
|
|
|
}; |
|
|
|