diff options
| author | shrutip90 <[email protected]> | 2025-08-19 21:20:41 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-08-20 04:20:41 +0000 |
| commit | d250293c2e0a4a50f5ef6b4b6cd3257730338d13 (patch) | |
| tree | da91b3cc7af02e40bc80df6857a2b2abcc12d4e3 /packages/cli/src/ui/hooks/useAuthCommand.ts | |
| parent | 179f1414daf9058a05d38a170c0d36ca9f2b8547 (diff) | |
Ignore workspace settings for untrusted folders (#6606)
Diffstat (limited to 'packages/cli/src/ui/hooks/useAuthCommand.ts')
| -rw-r--r-- | packages/cli/src/ui/hooks/useAuthCommand.ts | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/packages/cli/src/ui/hooks/useAuthCommand.ts b/packages/cli/src/ui/hooks/useAuthCommand.ts index e57a11af..b92fe604 100644 --- a/packages/cli/src/ui/hooks/useAuthCommand.ts +++ b/packages/cli/src/ui/hooks/useAuthCommand.ts @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { useState, useCallback, useEffect } from 'react'; +import { useState, useCallback, useEffect, useContext } from 'react'; import { LoadedSettings, SettingScope } from '../../config/settings.js'; import { AuthType, @@ -13,6 +13,7 @@ import { getErrorMessage, } from '@google/gemini-cli-core'; import { runExitCleanup } from '../../utils/cleanup.js'; +import { SettingsContext } from '../contexts/SettingsContext.js'; export const useAuthCommand = ( settings: LoadedSettings, @@ -22,6 +23,7 @@ export const useAuthCommand = ( const [isAuthDialogOpen, setIsAuthDialogOpen] = useState( settings.merged.selectedAuthType === undefined, ); + const settingsContext = useContext(SettingsContext); const openAuthDialog = useCallback(() => { setIsAuthDialogOpen(true); @@ -56,7 +58,7 @@ export const useAuthCommand = ( if (authType) { await clearCachedCredentialFile(); - settings.setValue(scope, 'selectedAuthType', authType); + settingsContext?.settings.setValue(scope, 'selectedAuthType', authType); if ( authType === AuthType.LOGIN_WITH_GOOGLE && config.isBrowserLaunchSuppressed() @@ -75,7 +77,7 @@ Logging in with Google... Please restart Gemini CLI to continue. setIsAuthDialogOpen(false); setAuthError(null); }, - [settings, setAuthError, config], + [settingsContext, setAuthError, config], ); const cancelAuthentication = useCallback(() => { |
