The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
fix signup threshold for welcome screen
Steven Teyac3d4fac170f
diff --git a/lib/middleware/app.ts b/lib/middleware/app.tsindex 281cbf4992..2cb376aa27 100644--- a/lib/middleware/app.ts+++ b/lib/middleware/app.ts@@ -23,11 +23,11 @@ export default async function AppMiddleware(req: NextRequest) {// if there's a session} else if (session?.email) {- // if the user was created in the last 5 minutes and the path isn't /welcome, redirect to /welcome+ // if the user was created in the last 10s and the path isn't /welcome, redirect to /welcome// (this is a workaround because the `isNewUser` flag is triggered when a user does `dangerousEmailAccountLinking`)if (session?.user?.createdAt &&- new Date(session?.user?.createdAt).getTime() > Date.now() - 300000 &&+ new Date(session?.user?.createdAt).getTime() > Date.now() - 10000 &&path !== "/welcome") {return NextResponse.redirect(new URL("/welcome", req.url));diff --git a/pages/api/auth/[...nextauth].tsx b/pages/api/auth/[...nextauth].tsxindex 96200ec75c..950c4ca595 100644--- a/pages/api/auth/[...nextauth].tsx+++ b/pages/api/auth/[...nextauth].tsx@@ -75,7 +75,7 @@ export const authOptions: NextAuthOptions = {}return true;},- jwt: async ({ token, user, trigger, session }) => {+ jwt: async ({ token, user, trigger }) => {if (!token.email || (await isBlacklistedEmail(token.email))) {return {};}@@ -113,11 +113,11 @@ export const authOptions: NextAuthOptions = {createdAt: true,},});- // only send the welcome email if the user was created in the last 5 minutes+ // only send the welcome email if the user was created in the last 10s// (this is a workaround because the `isNewUser` flag is triggered when a user does `dangerousEmailAccountLinking`)if (user?.createdAt &&- new Date(user.createdAt).getTime() > Date.now() - 300000+ new Date(user.createdAt).getTime() > Date.now() - 10000) {sendEmail({subject: "Welcome to Dub.sh!",