feat: scope workspace routes by organization slug
This commit is contained in:
@@ -27,6 +27,7 @@ import type {
|
||||
PublicAccount,
|
||||
Session,
|
||||
} from "@/modules/core/types";
|
||||
import { RESERVED_WORKSPACE_SLUGS } from "@/modules/shared/lib/workspace-routing";
|
||||
|
||||
const SESSION_COOKIE = "teatea_session";
|
||||
const SESSION_MAX_AGE_SECONDS = 60 * 60 * 24 * 7;
|
||||
@@ -154,7 +155,8 @@ function createSlug(name: string): string {
|
||||
.replace(/[^a-z0-9]+/g, "-")
|
||||
.replace(/^-|-$/g, "");
|
||||
|
||||
return base.length > 0 ? base : `org-${Date.now()}`;
|
||||
const slug = base.length > 0 ? base : `org-${Date.now()}`;
|
||||
return RESERVED_WORKSPACE_SLUGS.has(slug) ? `org-${slug}` : slug;
|
||||
}
|
||||
|
||||
export async function setSessionCookie(sessionId: string): Promise<void> {
|
||||
|
||||
Reference in New Issue
Block a user