mirror of
https://github.com/fiatjaf/nak.git
synced 2024-11-25 00:59:08 -05:00
fix password input lowercasing characters.
fixes https://github.com/fiatjaf/nak/issues/28
This commit is contained in:
parent
3d78e91f62
commit
d226cd6ce4
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user