From 4fe1625f8d0741b46a81973484a83aa13bf98246 Mon Sep 17 00:00:00 2001 From: laurentlemercier <22855554+laurentlemercier@users.noreply.github.com> Date: Sun, 11 Feb 2024 22:56:04 +0100 Subject: [PATCH] Update reset-password.ts You can use a variable in order to set password value : docker exec -e PASSWORD=value -it dockge npm run reset-password and you still have the standard behavior when no PASSWORD provided : docker exec -it dockge npm run reset-password --- extra/reset-password.ts | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/extra/reset-password.ts b/extra/reset-password.ts index 696fb4c..d7364a6 100644 --- a/extra/reset-password.ts +++ b/extra/reset-password.ts @@ -38,10 +38,22 @@ export const main = async () => { console.log("Found user: " + user.username); - while (true) { - let password = await question("New Password: "); - let confirmPassword = await question("Confirm New Password: "); + let password = ""; + let confirmPassword = " "; + while (true) { + if (process.env.PASSWORD) { + console.log("Found password : " + process.env.PASSWORD) ; + password = process.env.PASSWORD ; + confirmPassword = process.env.PASSWORD ; + } else { + console.log("No found password: " ) ; + password = await question("New Password: "); + confirmPassword = await question("Confirm New Password: "); + } + + // console.log("Password to be set :" + password); + if (password === confirmPassword) { await User.resetPassword(user.id, password);