mirror of
https://github.com/gristlabs/grist-core.git
synced 2024-10-27 20:44:07 +00:00
(core) show any error when creating initial team site with GRIST_SINGLE_ORG
Summary: Also clarifies that only lowercase letters are accepted. Test Plan: manual Reviewers: jarek Reviewed By: jarek Subscribers: jarek Differential Revision: https://phab.getgrist.com/D3647
This commit is contained in:
parent
198beaab2a
commit
0eb1fec3d7
@ -41,7 +41,7 @@ const BLACKLISTED_SUBDOMAINS = new Set([
|
|||||||
export function checkSubdomainValidity(subdomain: string): void {
|
export function checkSubdomainValidity(subdomain: string): void {
|
||||||
// stick with limited alphanumeric subdomains.
|
// stick with limited alphanumeric subdomains.
|
||||||
if (!(/^[a-z0-9][-a-z0-9]*$/.test(subdomain))) {
|
if (!(/^[a-z0-9][-a-z0-9]*$/.test(subdomain))) {
|
||||||
throw new Error('Domain must include letters, numbers, and dashes only.');
|
throw new Error('Domain must include lower-case letters, numbers, and dashes only.');
|
||||||
}
|
}
|
||||||
// 'docs-*' is reserved for personal orgs.
|
// 'docs-*' is reserved for personal orgs.
|
||||||
if (subdomain.startsWith('docs-')) { throw new Error('Domain cannot use reserved prefix "docs-".'); }
|
if (subdomain.startsWith('docs-')) { throw new Error('Domain cannot use reserved prefix "docs-".'); }
|
||||||
|
@ -80,14 +80,14 @@ export function addSiteCommand(program: commander.Command,
|
|||||||
// This should not happen.
|
// This should not happen.
|
||||||
throw new Error('failed to create user');
|
throw new Error('failed to create user');
|
||||||
}
|
}
|
||||||
await db.addOrg(user, {
|
db.unwrapQueryResult(await db.addOrg(user, {
|
||||||
name: domain,
|
name: domain,
|
||||||
domain,
|
domain,
|
||||||
}, {
|
}, {
|
||||||
setUserAsOwner: false,
|
setUserAsOwner: false,
|
||||||
useNewPlan: true,
|
useNewPlan: true,
|
||||||
planType: 'teamFree'
|
planType: 'teamFree'
|
||||||
});
|
}));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,14 +86,14 @@ export async function main() {
|
|||||||
// This should not happen.
|
// This should not happen.
|
||||||
throw new Error('failed to create GRIST_DEFAULT_EMAIL user');
|
throw new Error('failed to create GRIST_DEFAULT_EMAIL user');
|
||||||
}
|
}
|
||||||
await db.addOrg(user, {
|
db.unwrapQueryResult(await db.addOrg(user, {
|
||||||
name: org,
|
name: org,
|
||||||
domain: org,
|
domain: org,
|
||||||
}, {
|
}, {
|
||||||
setUserAsOwner: false,
|
setUserAsOwner: false,
|
||||||
useNewPlan: true,
|
useNewPlan: true,
|
||||||
planType: TEAM_FREE_PLAN
|
planType: TEAM_FREE_PLAN
|
||||||
});
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -102,6 +102,7 @@ export async function main() {
|
|||||||
if (process.env.GRIST_TESTING_SOCKET) {
|
if (process.env.GRIST_TESTING_SOCKET) {
|
||||||
await server.addTestingHooks();
|
await server.addTestingHooks();
|
||||||
}
|
}
|
||||||
|
return server;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (require.main === module) {
|
if (require.main === module) {
|
||||||
|
Loading…
Reference in New Issue
Block a user