fix: rely on term.ReadPassword for password prompts#84
fix: rely on term.ReadPassword for password prompts#84balajz merged 3 commits intobalajz:mainbalajz/pgxcli:mainfrom GHX5T-SOL:fix/82-password-prompt-readpasswordGHX5T-SOL/pgxcli:fix/82-password-prompt-readpasswordCopy head branch name to clipboard
Conversation
|
I think the problem is with these lines Lines 322 to 329 in 91d6987 |
|
Thanks, that points to the missing part. I pushed What changed:
Validation:
|
|
Let me explain the workflow. When I tries to connect without a password, it should first attempt a Unix socket connection with no password. If the connection succeeds, everything proceeds normally. If it fails due to an authentication error, we then prompt the user to enter a password, but we don’t prompt that the previous attempt failed, since the user never actually entered a password. The application should then try to connect again, making it appear to the user as if this is the first connection attempt. |
|
Thanks, that workflow makes sense. I pushed bda9634 to restore the passwordless first connection attempt and only suppress the warning when that first failed auth attempt used an empty password. Behavior now:
Validation:
|
|
Thank you for your contribution. I’d love to see more contributions from you in the future. |
Closes #82.
Summary
term.ReadPasswordmanage terminal password console modes directly instead of putting stdin into raw mode firstValidation
go test ./internal/cli -run TestPromptPasswordFallsBackToFullLineInput -count=1go test ./internal/cligo test ./internal/databasego test ./...go build -o /tmp/pgxcli-opp148 ./cmd/pgxclimake buildgo vet ./..../bin/app --helpgit diff --checkgit diff --cached --checkNot run
make lintbecausegolangci-lintis not installed locally (make: golangci-lint: No such file or directory).