feat(settings/components): introduce password input for API key to enhance security

This commit is contained in:
kangfenmao 2024-07-19 13:38:44 +08:00
parent 93a5739d87
commit c4394b925d

View File

@ -75,13 +75,14 @@ const ProviderSetting: FC<Props> = ({ provider: _provider }) => {
<Divider style={{ width: '100%', margin: '10px 0' }} /> <Divider style={{ width: '100%', margin: '10px 0' }} />
<SettingSubtitle style={{ marginTop: 5 }}>{t('settings.provider.api_key')}</SettingSubtitle> <SettingSubtitle style={{ marginTop: 5 }}>{t('settings.provider.api_key')}</SettingSubtitle>
<Space.Compact style={{ width: '100%' }}> <Space.Compact style={{ width: '100%' }}>
<Input <Input.Password
value={apiKey} value={apiKey}
placeholder={t('settings.provider.api_key')} placeholder={t('settings.provider.api_key')}
onChange={(e) => setApiKey(e.target.value)} onChange={(e) => setApiKey(e.target.value)}
onBlur={onUpdateApiKey} onBlur={onUpdateApiKey}
spellCheck={false} spellCheck={false}
disabled={apiKeyDisabled} disabled={apiKeyDisabled}
type="password"
autoFocus={provider.enabled && apiKey === ''} autoFocus={provider.enabled && apiKey === ''}
/> />
{!apiKeyDisabled && ( {!apiKeyDisabled && (