diff --git a/apps/dashboard/src/middleware.ts b/apps/dashboard/src/middleware.ts index 371b50ab6b..5e781bb55f 100644 --- a/apps/dashboard/src/middleware.ts +++ b/apps/dashboard/src/middleware.ts @@ -54,6 +54,11 @@ export async function middleware(request: NextRequest) { session && !session?.user?.user_metadata?.full_name ) { + // Check if the URL contains an invite code + const inviteCodeMatch = newUrl.pathname.startsWith("/teams/invite/"); + if (inviteCodeMatch) { + return NextResponse.redirect(`${url.origin}${newUrl.pathname}`); + } return NextResponse.redirect(`${url.origin}/setup`); }