diff --git a/messages/en-US.json b/messages/en-US.json index 61ff3ca6..58bbd825 100644 --- a/messages/en-US.json +++ b/messages/en-US.json @@ -1255,5 +1255,20 @@ "securityKeyRemoveTitle": "Remove Security Key", "securityKeyRemoveDescription": "Enter your password to remove the security key \"{name}\"", "securityKeyNoKeysRegistered": "No security keys registered", - "securityKeyNoKeysDescription": "Add a security key to enhance your account security" + "securityKeyNoKeysDescription": "Add a security key to enhance your account security", + "createDomainRequired": "Domain is required", + "createDomainAddDnsRecords": "Add DNS Records", + "createDomainAddDnsRecordsDescription": "Add the following DNS records to your domain provider to complete the setup.", + "createDomainNsRecords": "NS Records", + "createDomainRecord": "Record", + "createDomainType": "Type:", + "createDomainName": "Name:", + "createDomainValue": "Value:", + "createDomainCnameRecords": "CNAME Records", + "createDomainRecordNumber": "Record {number}", + "createDomainTxtRecords": "TXT Records", + "createDomainSaveTheseRecords": "Save These Records", + "createDomainSaveTheseRecordsDescription": "Make sure to save these DNS records as you will not see them again.", + "createDomainDnsPropagation": "DNS Propagation", + "createDomainDnsPropagationDescription": "DNS changes may take some time to propagate across the internet. This can take anywhere from a few minutes to 48 hours, depending on your DNS provider and TTL settings." } diff --git a/server/routers/domain/deleteOrgDomain.ts b/server/routers/domain/deleteOrgDomain.ts index aea2a2fa..345dafe7 100644 --- a/server/routers/domain/deleteOrgDomain.ts +++ b/server/routers/domain/deleteOrgDomain.ts @@ -39,6 +39,38 @@ export async function deleteAccountDomain( let numOrgDomains: OrgDomains[] | undefined; await db.transaction(async (trx) => { + const [existing] = await trx + .select() + .from(orgDomains) + .where( + and( + eq(orgDomains.orgId, orgId), + eq(orgDomains.domainId, domainId) + ) + ) + .innerJoin( + domains, + eq(orgDomains.domainId, domains.domainId) + ); + + if (!existing) { + return next( + createHttpError( + HttpCode.NOT_FOUND, + "Domain not found for this account" + ) + ); + } + + if (existing.domains.configManaged) { + return next( + createHttpError( + HttpCode.BAD_REQUEST, + "Cannot delete a domain that is managed by the config" + ) + ); + } + await trx .delete(orgDomains) .where( diff --git a/src/app/[orgId]/settings/domains/CreateDomainForm.tsx b/src/app/[orgId]/settings/domains/CreateDomainForm.tsx index aeca2963..74110a52 100644 --- a/src/app/[orgId]/settings/domains/CreateDomainForm.tsx +++ b/src/app/[orgId]/settings/domains/CreateDomainForm.tsx @@ -197,11 +197,10 @@ export default function CreateDomainForm({ - Add DNS Records + {t("createDomainAddDnsRecords")} - Add the following DNS records to your domain - provider to complete the setup. + {t("createDomainAddDnsRecordsDescription")} @@ -210,18 +209,18 @@ export default function CreateDomainForm({ createdDomain.nsRecords && (

- NS Records + {t("createDomainNsRecords")}

- Record + {t("createDomainRecord")}
- Type: + {t("createDomainType")} NS @@ -229,14 +228,14 @@ export default function CreateDomainForm({
- Name: + {t("createDomainName")} {baseDomain}
- Value: + {t("createDomainValue")} {createdDomain.nsRecords.map( ( @@ -272,7 +271,7 @@ export default function CreateDomainForm({ .length > 0 && (

- CNAME Records + {t("createDomainCnameRecords")}

{createdDomain.cnameRecords.map( @@ -285,16 +284,14 @@ export default function CreateDomainForm({ index } > - - Record{" "} - {index + - 1} - + + {t("createDomainRecordNumber", { number: index + 1 })} +
- Type: + {t("createDomainType")} CNAME @@ -302,7 +299,7 @@ export default function CreateDomainForm({
- Name: + {t("createDomainName")} { @@ -312,7 +309,7 @@ export default function CreateDomainForm({
- Value: + {t("createDomainValue")} 0 && (

- TXT Records + {t("createDomainTxtRecords")}

{createdDomain.txtRecords.map( @@ -347,16 +344,14 @@ export default function CreateDomainForm({ index } > - - Record{" "} - {index + - 1} - + + {t("createDomainRecordNumber", { number: index + 1 })} +
- Type: + {t("createDomainType")} TXT @@ -364,7 +359,7 @@ export default function CreateDomainForm({
- Name: + {t("createDomainName")} { @@ -374,7 +369,7 @@ export default function CreateDomainForm({
- Value: + {t("createDomainValue")} - Save These Records + {t("createDomainSaveTheseRecords")} - Make sure to save these DNS records - as you will not see them again. + {t("createDomainSaveTheseRecordsDescription")} ))} @@ -411,13 +405,10 @@ export default function CreateDomainForm({ - DNS Propagation + {t("createDomainDnsPropagation")} - DNS changes may take some time to propagate - across the internet. This can take anywhere - from a few minutes to 48 hours, depending on - your DNS provider and TTL settings. + {t("createDomainDnsPropagationDescription")}