Skip to content

Commit c4d280b

Browse files
Fix domain verification string comparison
Add null safety and normalize casing inconsistencies in domain nameserver checks. Use optional chaining and consistent toLowerCase() method across all domain verification logic.
1 parent aa8ecb7 commit c4d280b

File tree

7 files changed

+10
-10
lines changed

7 files changed

+10
-10
lines changed

src/routes/(console)/organization-[organization]/domains/+page.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
let selectedDomain: Models.Domain = null;
4242
4343
const isDomainVerified = (domain: Models.Domain) => {
44-
return domain.nameservers.toLocaleLowerCase() === 'appwrite';
44+
return domain.nameservers.toLowerCase() === 'appwrite';
4545
};
4646
</script>
4747

src/routes/(console)/organization-[organization]/domains/domain-[domain]/domainMetrics.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
let { domain, retryVerification }: { domain: Models.Domain; retryVerification: () => void } =
99
$props();
1010
11-
const isDomainVerified = domain.nameservers.toLocaleLowerCase() === 'appwrite';
11+
const isDomainVerified = domain.nameservers.toLowerCase() === 'appwrite';
1212
1313
const metrics = [
1414
{
@@ -29,7 +29,7 @@
2929
},
3030
{
3131
value:
32-
domain?.registrar?.toLocaleLowerCase() === 'appwrite'
32+
domain?.registrar?.toLowerCase() === 'appwrite'
3333
? domain?.autoRenewal
3434
? 'On'
3535
: 'Off'

src/routes/(console)/organization-[organization]/domains/recordsCard.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
async function verifyStatus() {
3636
try {
3737
domain = await sdk.forConsole.domains.updateNameservers(domain.$id);
38-
verified = domain.nameservers === 'Appwrite';
38+
verified = domain.nameservers.toLowerCase() === 'appwrite';
3939
if (verified) {
4040
addNotification({
4141
type: 'success',

src/routes/(console)/organization-[organization]/domains/retryDomainModal.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
try {
2424
const domain = await sdk.forConsole.domains.updateNameservers(selectedDomain.$id);
2525
show = false;
26-
if (domain.nameservers === 'Appwrite') {
26+
if (domain.nameservers.toLowerCase() === 'appwrite') {
2727
addNotification({
2828
type: 'success',
2929
message: `${selectedDomain.domain} has been verified`

src/routes/(console)/project-[region]-[project]/functions/function-[function]/domains/add-domain/verify-[domain]/+page.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,10 @@
6363
$organization.$id,
6464
page.params.domain
6565
);
66-
verified = domainData.nameservers.toLocaleLowerCase() === 'appwrite';
66+
verified = domainData.nameservers.toLowerCase() === 'appwrite';
6767
} else if (!isNewDomain && isCloud) {
6868
const domain = await sdk.forConsole.domains.updateNameservers(domainId);
69-
verified = domain.nameservers === 'Appwrite';
69+
verified = domain.nameservers.toLowerCase() === 'appwrite';
7070
if (!verified)
7171
throw new Error(
7272
'Domain verification failed. Please check your domain settings or try again later'

src/routes/(console)/project-[region]-[project]/settings/domains/add-domain/verify-[domain]/+page.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,10 @@
6464
$organization.$id,
6565
page.params.domain
6666
);
67-
verified = domainData.nameservers.toLocaleLowerCase() === 'appwrite';
67+
verified = domainData.nameservers.toLowerCase() === 'appwrite';
6868
} else if (!isNewDomain && isCloud) {
6969
const domain = await sdk.forConsole.domains.updateNameservers(domainId);
70-
verified = domain.nameservers === 'Appwrite';
70+
verified = domain.nameservers.toLowerCase() === 'appwrite';
7171
if (!verified)
7272
throw new Error(
7373
'Domain verification failed. Please check your domain settings or try again later'

src/routes/(console)/project-[region]-[project]/sites/site-[site]/domains/add-domain/verify-[domain]/+page.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
$organization.$id,
6767
page.params.domain
6868
);
69-
verified = domainData.nameservers.toLocaleLowerCase() === 'appwrite';
69+
verified = domainData.nameservers.toLowerCase() === 'appwrite';
7070
throw new Error(
7171
'Domain verification failed. Please check your domain settings or try again later'
7272
);

0 commit comments

Comments
 (0)