Prompt admin for user log at user creation
This commit is contained in:
parent
b73696a8bf
commit
410eff428b
@ -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(
|
||||
|
@ -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))}.`);
|
||||
|
Loading…
Reference in New Issue
Block a user