Skip to content

login: ask which account, so a bare login can add one - #12

Merged
ale-rinaldi merged 1 commit into
mainfrom
fix/login-can-add-an-account
Sep 5, 2026
Merged

login: ask which account, so a bare login can add one#12
ale-rinaldi merged 1 commit into
mainfrom
fix/login-can-add-an-account

Conversation

@ale-rinaldi

Copy link
Copy Markdown
Member

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 login could never see one. With an account already configured it took that email and asked only for a password:

$ dwshell login
Password:                      # …for which account? It never said.

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:

$ dwshell login
User (email) [[email protected]]: [email protected]
Password: …
  • Enter accepts the default: refreshing the account you have stays one keystroke.
  • Typing another email registers a second account.
  • --user still answers up front.
  • With no terminal nothing is asked and the default account is used, so scripts behave exactly as before.

Verification

loginUser is 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:

result
bare login, typing a different email second account registered, default unchanged
bare login, Enter refreshes the default account
no terminal no prompt, default account used

gofmt, go vet, go test -race ./... green.

🤖 Generated with Claude Code

https://claude.ai/code/session_01MvidAFW9a2r4hTgHPW9ywG

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
@ale-rinaldi
ale-rinaldi merged commit 748148d into main Sep 5, 2026
1 check passed
@ale-rinaldi
ale-rinaldi deleted the fix/login-can-add-an-account branch September 5, 2026 22:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant