Skip to content

Commit

Permalink
fix password input lowercasing characters.
Browse files Browse the repository at this point in the history
fixes #28
fiatjaf committed Aug 6, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 3d78e91 commit d226cd6
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions helpers.go
Original file line number Diff line number Diff line change
@@ -261,22 +261,18 @@ func askPassword(msg string, shouldAskAgain func(answer string) bool) (string, e
EnableMask: true,
MaskRune: '*',
}
return _ask(config, msg, "", shouldAskAgain)
}

func _ask(config *readline.Config, msg string, defaultValue string, shouldAskAgain func(answer string) bool) (string, error) {
rl, err := readline.NewEx(config)
if err != nil {
return "", err
}

rl.WriteStdin([]byte(defaultValue))
for {
answer, err := rl.Readline()
if err != nil {
return "", err
}
answer = strings.TrimSpace(strings.ToLower(answer))
answer = strings.TrimSpace(answer)
if shouldAskAgain != nil && shouldAskAgain(answer) {
continue
}

0 comments on commit d226cd6

Please sign in to comment.