Warn when adding or listing users in public mode
This commit is contained in:
parent
f221121998
commit
aa49856446
@ -11,12 +11,18 @@ program
|
||||
.description("Add a new user")
|
||||
.on("--help", Utils.extraHelp)
|
||||
.action(function(name) {
|
||||
var manager = new ClientManager();
|
||||
var users = manager.getUsers();
|
||||
if (Helper.config.public) {
|
||||
log.warn(`Users have no effect in ${colors.bold("public")} mode.`);
|
||||
}
|
||||
|
||||
const manager = new ClientManager();
|
||||
const users = manager.getUsers();
|
||||
|
||||
if (users.indexOf(name) !== -1) {
|
||||
log.error(`User ${colors.bold(name)} already exists.`);
|
||||
return;
|
||||
}
|
||||
|
||||
log.prompt({
|
||||
text: "Enter password:",
|
||||
silent: true
|
||||
|
@ -3,6 +3,7 @@
|
||||
var ClientManager = new require("../clientManager");
|
||||
var program = require("commander");
|
||||
var colors = require("colors/safe");
|
||||
const Helper = require("../helper");
|
||||
const Utils = require("./utils");
|
||||
|
||||
program
|
||||
@ -10,6 +11,10 @@ program
|
||||
.description("List all users")
|
||||
.on("--help", Utils.extraHelp)
|
||||
.action(function() {
|
||||
if (Helper.config.public) {
|
||||
log.warn(`Users have no effect in ${colors.bold("public")} mode.`);
|
||||
}
|
||||
|
||||
var users = new ClientManager().getUsers();
|
||||
if (!users.length) {
|
||||
log.info(`There are currently no users. Create one with ${colors.bold("lounge add <name>")}.`);
|
||||
|
Loading…
Reference in New Issue
Block a user