1 import * as program from 'commander'
3 import { database as db } from '../server/initializers/database'
6 .option('-u, --user [user]', 'User')
9 if (program.user === undefined) {
10 console.error('All parameters are mandatory.')
14 db.init(true, function () {
15 db.User.loadByUsername(program.user, function (err, user) {
22 console.error('User unknown.')
26 const readline = require('readline')
27 const Writable = require('stream').Writable
28 const mutableStdout = new Writable({
29 write: function (chunk, encoding, callback) {
33 const rl = readline.createInterface({
35 output: mutableStdout,
39 console.log('New password?')
40 rl.on('line', function (password) {
41 user.password = password
43 user.save().asCallback(function (err) {
47 console.log('User password updated.')