mirror of
https://github.com/logto-io/logto.git
synced 2025-01-06 20:40:08 -05:00
fix(console): add url check for logo (#2771)
This commit is contained in:
parent
ce48251920
commit
28f8e8a9a8
1 changed files with 16 additions and 2 deletions
|
@ -12,6 +12,7 @@ import FormField from '@/components/FormField';
|
||||||
import Select from '@/components/Select';
|
import Select from '@/components/Select';
|
||||||
import TextInput from '@/components/TextInput';
|
import TextInput from '@/components/TextInput';
|
||||||
import TextLink from '@/components/TextLink';
|
import TextLink from '@/components/TextLink';
|
||||||
|
import { uriValidator } from '@/utilities/validator';
|
||||||
|
|
||||||
import type { ConnectorFormType } from '../../types';
|
import type { ConnectorFormType } from '../../types';
|
||||||
import { SyncProfileMode } from '../../types';
|
import { SyncProfileMode } from '../../types';
|
||||||
|
@ -60,14 +61,27 @@ const ConnectorForm = ({ connector, isAllowEditTarget }: Props) => {
|
||||||
<div className={styles.tip}>{t('connectors.guide.name_tip')}</div>
|
<div className={styles.tip}>{t('connectors.guide.name_tip')}</div>
|
||||||
</FormField>
|
</FormField>
|
||||||
<FormField title="connectors.guide.logo">
|
<FormField title="connectors.guide.logo">
|
||||||
<TextInput placeholder={t('connectors.guide.logo_placeholder')} {...register('logo')} />
|
<TextInput
|
||||||
|
placeholder={t('connectors.guide.logo_placeholder')}
|
||||||
|
hasError={Boolean(errors.logo)}
|
||||||
|
errorMessage={errors.logo?.message}
|
||||||
|
{...register('logo', {
|
||||||
|
validate: (value) =>
|
||||||
|
!value || uriValidator(value) || t('errors.invalid_uri_format'),
|
||||||
|
})}
|
||||||
|
/>
|
||||||
<div className={styles.tip}>{t('connectors.guide.logo_tip')}</div>
|
<div className={styles.tip}>{t('connectors.guide.logo_tip')}</div>
|
||||||
</FormField>
|
</FormField>
|
||||||
{darkVisible && (
|
{darkVisible && (
|
||||||
<FormField title="connectors.guide.logo_dark">
|
<FormField title="connectors.guide.logo_dark">
|
||||||
<TextInput
|
<TextInput
|
||||||
placeholder={t('connectors.guide.logo_dark_placeholder')}
|
placeholder={t('connectors.guide.logo_dark_placeholder')}
|
||||||
{...register('logoDark')}
|
hasError={Boolean(errors.logoDark)}
|
||||||
|
errorMessage={errors.logoDark?.message}
|
||||||
|
{...register('logoDark', {
|
||||||
|
validate: (value) =>
|
||||||
|
!value || uriValidator(value) || t('errors.invalid_uri_format'),
|
||||||
|
})}
|
||||||
/>
|
/>
|
||||||
<div className={styles.tip}>{t('connectors.guide.logo_dark_tip')}</div>
|
<div className={styles.tip}>{t('connectors.guide.logo_dark_tip')}</div>
|
||||||
</FormField>
|
</FormField>
|
||||||
|
|
Loading…
Reference in a new issue