Compare commits

..

1 Commits

Author SHA1 Message Date
Henry
7ffd70b6d2 feat: redirect from root to login for self hosted instances 2025-07-10 21:48:08 +01:00
2 changed files with 20 additions and 9 deletions

View File

@@ -0,0 +1,18 @@
import type { NextRequest } from "next/server";
import { NextResponse } from "next/server";
import { env } from "next-runtime-env";
export function middleware(request: NextRequest) {
if (request.nextUrl.pathname === "/") {
if (env("NEXT_PUBLIC_KAN_ENV") !== "cloud") {
const loginUrl = new URL("/login", request.url);
return NextResponse.redirect(loginUrl);
}
}
return NextResponse.next();
}
export const config = {
matcher: ["/"],
};

View File

@@ -83,18 +83,11 @@ export const memberRouter = createTRPCRouter({
callbackURL: `/boards?type=invite&memberPublicId=${invite.publicId}`,
});
if (error) {
console.error("Failed to send magic link invitation:", {
email: input.email,
callbackURL: `/boards?type=invite&memberPublicId=${invite.publicId}`,
error,
});
if (error)
throw new TRPCError({
message: `Failed to send magic link invitation to user with email ${input.email}.`,
message: `Failed to send magic link to user with email ${input.email}`,
code: "INTERNAL_SERVER_ERROR",
});
}
return invite;
}),