fix: add token link help

This commit is contained in:
Maël Gangloff
2025-02-19 00:54:04 +01:00
parent 34ea4dd37c
commit 27e60e566a
7 changed files with 110 additions and 74 deletions

View File

@@ -29,14 +29,12 @@ export default function AutoDnsConnectorForm({form, onCreate}: {
style={{marginBottom: '2em'}}
/>
<br/>
<Form.Item
label={t`AutoDNS Username`}
name={['authData', 'username']}
help={<Typography.Text
type='secondary'
>{t`Attention: AutoDNS do not support 2-Factor Authentication on API Users for automated systems`}
</Typography.Text>}
help={<Typography.Link target='_blank' href='https://en.autodns.com/domain-robot-api/'>
{t`Because of some limitations in API of AutoDNS, we suggest to create an dedicated user for API with limited rights`}
</Typography.Link>}
rules={[{required: true, message: t`Required`}]}
>
<Input autoComplete='off' required/>
@@ -44,6 +42,10 @@ export default function AutoDnsConnectorForm({form, onCreate}: {
<Form.Item
label={t`AutoDNS Password`}
name={['authData', 'password']}
help={<Typography.Text
type='secondary'
>{t`Attention: AutoDNS do not support 2-Factor Authentication on API Users for automated systems`}
</Typography.Text>}
rules={[{required: true, message: t`Required`}]}
required
>
@@ -54,7 +56,7 @@ export default function AutoDnsConnectorForm({form, onCreate}: {
name={['authData', 'contactid']}
help={<Typography.Text
type='secondary'
>{t`The nic-handle of the domain name owner`}<a
>{t`The nic-handle of the domain name owner`} <a
href='https://cloud.autodns.com/contacts/domain'
>{t`You can get it from this page`}
</a>

View File

@@ -26,6 +26,9 @@ export default function GandiConnectorForm({form, onCreate}: {
<Form.Item
label={t`Personal Access Token (PAT)`}
name={['authData', 'token']}
help={<Typography.Link target='_blank' href='https://admin.gandi.net/organizations/account/pat'>
{t`Retrieve a Personal Access Token from your customer account on the Provider's website`}
</Typography.Link>}
rules={[{required: true, message: t`Required`}]}
>
<Input autoComplete='off'/>

View File

@@ -1,5 +1,5 @@
import type {FormInstance} from 'antd'
import {Form, Input} from 'antd'
import {Form, Input, Typography} from 'antd'
import React from 'react'
import type {Connector} from '../../api/connectors'
import {ConnectorProvider} from '../../api/connectors'
@@ -27,6 +27,9 @@ export default function NamecheapConnectorForm({form, onCreate}: {
<Form.Item
label={t`Username`}
name={['authData', 'ApiUser']}
help={<Typography.Link target='_blank' href='https://ap.www.namecheap.com/settings/tools/apiaccess/'>
{t`Retreive an API key and whitelist this instance's IP address on Namecheap's website`}
</Typography.Link>}
>
<Input autoComplete='off'/>
</Form.Item>

View File

@@ -1,5 +1,5 @@
import type {FormInstance} from 'antd'
import {Alert, Form, Input} from 'antd'
import {Alert, Form, Input, Typography} from 'antd'
import React from 'react'
import type {Connector} from '../../api/connectors'
import {ConnectorProvider} from '../../api/connectors'
@@ -31,6 +31,9 @@ export default function NamecomConnectorForm({form, onCreate}: {
<Form.Item
label={t`Username`}
name={['authData', 'username']}
help={<Typography.Link target='_blank' href='https://www.name.com/account/settings/api'>
{t`Retrieve a set of tokens from your customer account on the Provider's website`}
</Typography.Link>}
>
<Input autoComplete='off'/>
</Form.Item>

View File

@@ -2,7 +2,7 @@ import {t} from 'ttag'
import {regionNames} from "../../../i18n"
import React, {useState} from 'react'
import type {FormInstance} from "antd"
import {Form, Input, Popconfirm, Select} from "antd"
import {Form, Input, Popconfirm, Select, Typography} from "antd"
import type {Connector} from "../../api/connectors"
import {ConnectorProvider} from "../../api/connectors"
import DefaultConnectorFormItems from "./DefaultConnectorFormItems"
@@ -48,6 +48,12 @@ export default function OvhCloudConnectorForm({form, onCreate}: {
label={t`Application key`}
name={['authData', 'appKey']}
rules={[{required: true, message: t`Required`}]}
help={<Typography.Link
target='_blank'
href='https://api.ovh.com/createToken/?GET=/order/cart&GET=/order/cart/*&POST=/order/cart&POST=/order/cart/*&DELETE=/order/cart/*&GET=/domain/extensions'
>
{t`Retrieve a set of tokens from your customer account on the Provider's website`}
</Typography.Link>}
>
<Input autoComplete='off'/>
</Form.Item>

View File

@@ -17,34 +17,28 @@ export const formItemLayoutWithOutLabel = {
export type ProviderConfig = {
tosLink: string
tokenLink: string
form: ({form, onCreate}: { form: FormInstance, onCreate: (values: Connector) => void }) => React.ReactElement
}
export const providersConfig: Record<ConnectorProvider, ProviderConfig> = {
[ConnectorProvider.OVHcloud]: {
tosLink: 'https://www.ovhcloud.com/en/terms-and-conditions/contracts/',
tokenLink: 'https://api.ovh.com/createToken/?GET=/order/cart&GET=/order/cart/*&POST=/order/cart&POST=/order/cart/*&DELETE=/order/cart/*&GET=/domain/extensions',
form: OvhCloudConnectorForm
},
[ConnectorProvider.Gandi]: {
tosLink: 'https://www.gandi.net/en/contracts/terms-of-service',
tokenLink: 'https://admin.gandi.net/organizations/account/pat',
form: GandiConnectorForm
},
[ConnectorProvider.Namecheap]: {
tosLink: 'https://www.namecheap.com/legal/universal/universal-tos/',
tokenLink: 'https://ap.www.namecheap.com/settings/tools/apiaccess/',
form: NamecheapConnectorForm
},
[ConnectorProvider.AutoDNS]: {
tosLink: 'https://www.internetx.com/agb/',
tokenLink: 'https://en.autodns.com/domain-robot-api/',
form: AutoDnsConnectorForm
},
[ConnectorProvider["Name.com"]]: {
tosLink: 'https://www.name.com/policies/',
tokenLink: 'https://www.name.com/account/settings/api',
form: NamecomConnectorForm
}
}