Skip to content

Commit

Permalink
Hide default values for passwords (#668)
Browse files Browse the repository at this point in the history
Addressing issue #635, this PR displays `[hidden]` as the default value instead of displaying the actual password, when applicable. The message is consistent with text displayed when the password is masked.
  • Loading branch information
bernot-dev authored and SBoudrias committed May 14, 2018
1 parent 156e5b0 commit 54cc022
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/prompts/base.js
Expand Up @@ -128,7 +128,12 @@ class Prompt {

// Append the default if available, and if question isn't answered
if (this.opt.default != null && this.status !== 'answered') {
message += chalk.dim('(' + this.opt.default + ') ');
// If default password is supplied, hide it
if (this.opt.type === 'password') {
message += chalk.italic.dim('[hidden] ');
} else {
message += chalk.dim('(' + this.opt.default + ') ');
}
}

return message;
Expand Down

0 comments on commit 54cc022

Please sign in to comment.