From 6348c9546305b0039570ef1d9f205e9420dbfb62 Mon Sep 17 00:00:00 2001 From: WenliangChang Date: Sat, 22 Aug 2026 03:06:38 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix:=E4=BF=AE=E5=A4=8D=E5=9C=A8=E6=A8=A1?= =?UTF-8?q?=E5=9E=8B=E9=85=8D=E7=BD=AE=E9=A1=B5=E9=9D=A2=E8=BE=93=E5=85=A5?= =?UTF-8?q?=E5=85=B7=E4=BD=93=E6=A8=A1=E5=9E=8B=E5=90=8D=E7=A7=B0=E6=97=B6?= =?UTF-8?q?,=E5=A6=82=E6=9E=9C=E5=90=8D=E5=AD=97=E4=B8=AD=E5=B8=A6?= =?UTF-8?q?=E6=9C=89w=20=E4=BC=9A=E8=87=AA=E5=8A=A8=E8=BF=9B=E5=85=A5works?= =?UTF-8?q?pace=20api=20key=E9=85=8D=E7=BD=AE=E9=A1=B5=E9=9D=A2,=E5=AF=BC?= =?UTF-8?q?=E8=87=B4qwen=E7=AD=89=E6=A8=A1=E5=9E=8B=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E5=AE=8C=E6=88=90=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/commands/login/login.tsx | 30 ++++++++++++++++------------- src/components/ConsoleOAuthFlow.tsx | 6 ++++++ 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/src/commands/login/login.tsx b/src/commands/login/login.tsx index 0c85753924..031e3b9811 100644 --- a/src/commands/login/login.tsx +++ b/src/commands/login/login.tsx @@ -77,6 +77,7 @@ export function Login(props: { }): React.ReactNode { const mainLoopModel = useMainLoopModel(); const [showWorkspaceKeyInput, setShowWorkspaceKeyInput] = React.useState(false); + const [loginMethodSelectionActive, setLoginMethodSelectionActive] = React.useState(true); // 'idle' | 'confirm-remove' | 'removing' | { error: string } const [removeState, setRemoveState] = React.useState< { phase: 'idle' } | { phase: 'confirm-remove' } | { phase: 'removing' } | { phase: 'error'; message: string } @@ -120,7 +121,7 @@ export function Login(props: { } return; } - if (input === 'w' || input === 'W') { + if ((input === 'w' || input === 'W') && loginMethodSelectionActive) { setShowWorkspaceKeyInput(true); return; } @@ -171,21 +172,24 @@ export function Login(props: { ) : ( <> - - {!workspaceKeySet ? ( - Press W to enter workspace API key (saves to settings, no restart needed) - ) : workspaceKeyFromSettings ? ( - Press W to replace workspace API key · Press D to remove it - ) : ( - - Workspace API key from ANTHROPIC_API_KEY env. Press W to override with a settings-saved key. - - )} - {removeState.phase === 'error' && {removeState.message}} - + {loginMethodSelectionActive && ( + + {!workspaceKeySet ? ( + Press W to enter workspace API key (saves to settings, no restart needed) + ) : workspaceKeyFromSettings ? ( + Press W to replace workspace API key · Press D to remove it + ) : ( + + Workspace API key from ANTHROPIC_API_KEY env. Press W to override with a settings-saved key. + + )} + {removeState.phase === 'error' && {removeState.message}} + + )} props.onDone(true, mainLoopModel)} startingMessage={props.startingMessage} + onLoginMethodSelectionActiveChange={setLoginMethodSelectionActive} /> )} diff --git a/src/components/ConsoleOAuthFlow.tsx b/src/components/ConsoleOAuthFlow.tsx index 8f4219ca30..2bdc08e0da 100644 --- a/src/components/ConsoleOAuthFlow.tsx +++ b/src/components/ConsoleOAuthFlow.tsx @@ -31,6 +31,7 @@ type Props = { startingMessage?: string; mode?: 'login' | 'setup-token'; forceLoginMethod?: 'claudeai' | 'console'; + onLoginMethodSelectionActiveChange?: (active: boolean) => void; }; type OAuthStatus = @@ -89,6 +90,7 @@ export function ConsoleOAuthFlow({ startingMessage, mode = 'login', forceLoginMethod: forceLoginMethodProp, + onLoginMethodSelectionActiveChange, }: Props): React.ReactNode { const settings = getSettings_DEPRECATED() || {}; const forceLoginMethod = forceLoginMethodProp ?? settings.forceLoginMethod; @@ -144,6 +146,10 @@ export function ConsoleOAuthFlow({ } }, [oauthStatus]); + useEffect(() => { + onLoginMethodSelectionActiveChange?.(oauthStatus.state === 'idle'); + }, [oauthStatus.state, onLoginMethodSelectionActiveChange]); + // Handle Enter to continue on success state useKeybinding( 'confirm:yes', From cd6a74df862693b0372716af2d82de6529acf650 Mon Sep 17 00:00:00 2001 From: WenliangChang Date: Sat, 22 Aug 2026 14:15:55 +0800 Subject: [PATCH 2/2] fix:add docString for input w error --- src/commands/login/login.tsx | 2 ++ src/components/ConsoleOAuthFlow.tsx | 1 + 2 files changed, 3 insertions(+) diff --git a/src/commands/login/login.tsx b/src/commands/login/login.tsx index 031e3b9811..b44b0c02a3 100644 --- a/src/commands/login/login.tsx +++ b/src/commands/login/login.tsx @@ -77,6 +77,7 @@ export function Login(props: { }): React.ReactNode { const mainLoopModel = useMainLoopModel(); const [showWorkspaceKeyInput, setShowWorkspaceKeyInput] = React.useState(false); + // Whether the login method selection is active const [loginMethodSelectionActive, setLoginMethodSelectionActive] = React.useState(true); // 'idle' | 'confirm-remove' | 'removing' | { error: string } const [removeState, setRemoveState] = React.useState< @@ -121,6 +122,7 @@ export function Login(props: { } return; } + // Only allow workspace key input if login method selection is active if ((input === 'w' || input === 'W') && loginMethodSelectionActive) { setShowWorkspaceKeyInput(true); return; diff --git a/src/components/ConsoleOAuthFlow.tsx b/src/components/ConsoleOAuthFlow.tsx index 2bdc08e0da..83ae04f9dd 100644 --- a/src/components/ConsoleOAuthFlow.tsx +++ b/src/components/ConsoleOAuthFlow.tsx @@ -146,6 +146,7 @@ export function ConsoleOAuthFlow({ } }, [oauthStatus]); + // Update login method selection active state useEffect(() => { onLoginMethodSelectionActiveChange?.(oauthStatus.state === 'idle'); }, [oauthStatus.state, onLoginMethodSelectionActiveChange]);