diff options
Diffstat (limited to 'scripts/reset-password.ts')
-rwxr-xr-x | scripts/reset-password.ts | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/scripts/reset-password.ts b/scripts/reset-password.ts index 6372095d6..7e7de6b8a 100755 --- a/scripts/reset-password.ts +++ b/scripts/reset-password.ts | |||
@@ -10,14 +10,16 @@ program | |||
10 | .option('-u, --user [user]', 'User') | 10 | .option('-u, --user [user]', 'User') |
11 | .parse(process.argv) | 11 | .parse(process.argv) |
12 | 12 | ||
13 | if (program['user'] === undefined) { | 13 | const options = program.opts() |
14 | |||
15 | if (options.user === undefined) { | ||
14 | console.error('All parameters are mandatory.') | 16 | console.error('All parameters are mandatory.') |
15 | process.exit(-1) | 17 | process.exit(-1) |
16 | } | 18 | } |
17 | 19 | ||
18 | initDatabaseModels(true) | 20 | initDatabaseModels(true) |
19 | .then(() => { | 21 | .then(() => { |
20 | return UserModel.loadByUsername(program['user']) | 22 | return UserModel.loadByUsername(options.user) |
21 | }) | 23 | }) |
22 | .then(user => { | 24 | .then(user => { |
23 | if (!user) { | 25 | if (!user) { |
@@ -28,7 +30,7 @@ initDatabaseModels(true) | |||
28 | const readline = require('readline') | 30 | const readline = require('readline') |
29 | const Writable = require('stream').Writable | 31 | const Writable = require('stream').Writable |
30 | const mutableStdout = new Writable({ | 32 | const mutableStdout = new Writable({ |
31 | write: function (chunk, encoding, callback) { | 33 | write: function (_chunk, _encoding, callback) { |
32 | callback() | 34 | callback() |
33 | } | 35 | } |
34 | }) | 36 | }) |