Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

properly verify user before otp redirect

Brendan Allan8bc7d89ae003
diff --git a/apps/web/app/(org)/verify-otp/page.tsx b/apps/web/app/(org)/verify-otp/page.tsx
index 4ea4e5d07..a31859b07 100644
--- a/apps/web/app/(org)/verify-otp/page.tsx
+++ b/apps/web/app/(org)/verify-otp/page.tsx
@@ -1,4 +1,4 @@
-import { getSession } from "@cap/database/auth/session";
+import { getCurrentUser } from "@cap/database/auth/session";
import { redirect } from "next/navigation";
import { Suspense } from "react";
import { VerifyOTPForm } from "./form";
@@ -11,9 +11,9 @@ export default async function VerifyOTPPage(props: {
searchParams: Promise<{ email?: string; next?: string; lastSent?: string }>;
}) {
const searchParams = await props.searchParams;
- const session = await getSession();
+ const user = await getCurrentUser();
- if (session?.user) {
+ if (user) {
redirect(searchParams.next || "/dashboard");
}