login: ask which account, so a bare login can add one - #12
Merged
Conversation
The accounts feature says an email not seen before registers a new account, but `dwshell login` could never see one: with an account already configured it took that email and asked only for a password. Adding a second account required knowing to pass --user, and typing the new account's password into a prompt bound to the old account's email failed with nothing pointing at the cause — the prompt never named the account it was for. The email is the account's identity, so it is asked for whenever there is someone to ask, offering the configured account as the answer. Refreshing it stays one keystroke, registering another is just typing it. --user still answers up front, and with no terminal a script uses the default account and is asked nothing, exactly as before. This was shipped broken in v1.4.0: the README documented the flow with --user, which works, but the flow the feature promised did not. Verified in a real terminal: typing a different email at the prompt registered a second account and left the default alone, Enter refreshed the default, and a script with no terminal saw no prompt. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01MvidAFW9a2r4hTgHPW9ywG
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A defect in v1.4.0, spotted by the user: "we said you add an account by running
dwshell login, but the current flow can't."The problem
The accounts feature keys an account by the email logged in — an unseen email registers a new account. But
dwshell logincould never see one. With an account already configured it took that email and asked only for a password:So adding a second account required knowing to pass
--user. Worse, someone typing the new account's password into that prompt would get an authentication failure with nothing pointing at the cause, because the prompt was bound to the old account's email and never named it.The README documented the flow with
--user, which works — but the flow the feature promised did not.The fix
The email is the account's identity, so it is asked for whenever there is someone to ask, offering the configured account as the answer:
--userstill answers up front.Verification
loginUseris separated from the prompt so the decision is testable — flag wins, prompt honoured, empty answer keeps the default, no terminal never asks, nothing configured offers nothing. Then the real thing, driven through a PTY:login, typing a different emaillogin, Entergofmt,go vet,go test -race ./...green.🤖 Generated with Claude Code
https://claude.ai/code/session_01MvidAFW9a2r4hTgHPW9ywG