diff --git a/src/clientManager.js b/src/clientManager.js index fd5aefd0..fc681cd9 100644 --- a/src/clientManager.js +++ b/src/clientManager.js @@ -82,7 +82,7 @@ ClientManager.prototype.getUsers = function() { return users; }; -ClientManager.prototype.addUser = function(name, password) { +ClientManager.prototype.addUser = function(name, password, enableLog) { var users = this.getUsers(); if (users.indexOf(name) !== -1) { return false; @@ -96,7 +96,7 @@ ClientManager.prototype.addUser = function(name, password) { var user = { user: name, password: password || "", - log: false, + log: enableLog, networks: [] }; fs.writeFileSync( diff --git a/src/command-line/add.js b/src/command-line/add.js index 613a02bd..7c0214c5 100644 --- a/src/command-line/add.js +++ b/src/command-line/add.js @@ -24,17 +24,26 @@ program return; } if (!err) { - add(manager, name, password); + log.prompt({ + text: "Save logs to disk?", + default: "yes" + }, function(err2, enableLog) { + if (!err2) { + add( + manager, + name, + password, + enableLog.charAt(0).toLowerCase() === "y" + ); + } + }); } }); }); -function add(manager, name, password) { +function add(manager, name, password, enableLog) { var hash = Helper.password.hash(password); - manager.addUser( - name, - hash - ); + manager.addUser(name, hash, enableLog); log.info(`User ${colors.bold(name)} created.`); log.info(`User file located at ${colors.green(Helper.getUserConfigPath(name))}.`);