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
This commit is contained in:
laurentlemercier 2024-02-11 22:56:04 +01:00 committed by GitHub
parent 4a9173f5dc
commit 4fe1625f8d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -38,9 +38,21 @@ export const main = async () => {
console.log("Found user: " + user.username); console.log("Found user: " + user.username);
let password = "";
let confirmPassword = " ";
while (true) { while (true) {
let password = await question("New Password: "); if (process.env.PASSWORD) {
let confirmPassword = await question("Confirm New 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) { if (password === confirmPassword) {
await User.resetPassword(user.id, password); await User.resetPassword(user.id, password);