0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2025-01-06 20:40:08 -05:00

fix(console): passwordless connectors should not show callbackUri (#3310)

This commit is contained in:
Darcy Ye 2023-03-08 11:29:16 +08:00 committed by GitHub
parent 1ca42e0573
commit 6fd51effdc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 25 additions and 10 deletions

View file

@ -115,7 +115,11 @@ const ConnectorContent = ({ isDeleted, connectorData, onConnectorUpdated }: Prop
!isSocialConnector && getDocumentationUrl('/docs/references/connectors')
)}
>
<ConfigForm formItems={connectorData.formItems} connectorId={connectorData.id} />
<ConfigForm
formItems={connectorData.formItems}
connectorId={connectorData.id}
connectorType={connectorData.type}
/>
</FormCard>
{/* Tell typescript that the connectorType is Email or Sms */}
{connectorData.type !== ConnectorType.Social && (

View file

@ -1,4 +1,5 @@
import type { ConnectorConfigFormItem } from '@logto/connector-kit';
import { ConnectorType } from '@logto/connector-kit';
import type { ConnectorFactoryResponse } from '@logto/schemas';
import { useContext } from 'react';
import { Controller, useFormContext } from 'react-hook-form';
@ -19,9 +20,16 @@ type Props = {
formItems?: ConnectorConfigFormItem[];
className?: string;
connectorId: string;
connectorType: ConnectorType;
};
const ConfigForm = ({ configTemplate, formItems, className, connectorId }: Props) => {
const ConfigForm = ({
configTemplate,
formItems,
className,
connectorId,
connectorType,
}: Props) => {
const { t } = useTranslation(undefined, { keyPrefix: 'admin_console' });
const {
control,
@ -31,14 +39,16 @@ const ConfigForm = ({ configTemplate, formItems, className, connectorId }: Props
return (
<div className={className}>
<FormField title="connectors.guide.callback_uri">
<CopyToClipboard
className={styles.copyToClipboard}
variant="border"
value={new URL(`/callback/${connectorId}`, userEndpoint).toString()}
/>
<div className={styles.description}>{t('connectors.guide.callback_uri_description')}</div>
</FormField>
{connectorType === ConnectorType.Social && (
<FormField title="connectors.guide.callback_uri">
<CopyToClipboard
className={styles.copyToClipboard}
variant="border"
value={new URL(`/callback/${connectorId}`, userEndpoint).toString()}
/>
<div className={styles.description}>{t('connectors.guide.callback_uri_description')}</div>
</FormField>
)}
{formItems ? (
<ConfigFormItems formItems={formItems} />
) : (

View file

@ -190,6 +190,7 @@ const Guide = ({ connector, onClose }: Props) => {
<ConfigForm
connectorId={callbackConnectorId}
configTemplate={connector.configTemplate}
connectorType={connectorType}
formItems={connector.formItems}
/>
</div>