diff options
author | isaacs <i@izs.me> | 2014-05-01 21:25:15 +0400 |
---|---|---|
committer | isaacs <i@izs.me> | 2014-05-01 21:26:04 +0400 |
commit | e90ef9e409b8de5601b52563b1bd52e68fcf5eba (patch) | |
tree | 0d71b52f35c11f84b7e16416b31a81b16ad5e9db /lib | |
parent | e772f1e66253f15350336391a26f084d121404fd (diff) |
adduser: Clarify password prompt
When there's the option to leave it unchanged, the prompt should reflect
this.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/adduser.js | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/adduser.js b/lib/adduser.js index 00d56383b..94a119683 100644 --- a/lib/adduser.js +++ b/lib/adduser.js @@ -66,12 +66,19 @@ function readUsername (c, u, cb) { function readPassword (c, u, cb) { var v = userValidate.pw - read({prompt: "Password: ", silent: true}, function (er, pw) { + var prompt + if (c.p && !c.changed) { + prompt = "Password: (or leave unchanged) " + } else { + prompt = "Password: " + } + + read({prompt: prompt, silent: true}, function (er, pw) { if (er) { return cb(er.message === "cancelled" ? er.message : er) } - if (!c.changed && pw === '') { + if (!c.changed && pw === "") { // when the username was not changed, // empty response means "use the old value" pw = c.p |