diff --git a/packages/better-auth/src/plugins/two-factor/backup-codes/index.ts b/packages/better-auth/src/plugins/two-factor/backup-codes/index.ts index 025a8ed36b..7006eaf916 100644 --- a/packages/better-auth/src/plugins/two-factor/backup-codes/index.ts +++ b/packages/better-auth/src/plugins/two-factor/backup-codes/index.ts @@ -103,7 +103,22 @@ export const backupCode2fa = (options?: BackupCodeOptions) => { /** * Disable setting the session cookie */ - disableSession: z.boolean().optional(), + disableSession: z + .boolean({ + description: "If true, the session cookie will not be set.", + }) + .optional(), + /** + * if true, the device will be trusted + * for 30 days. It'll be refreshed on + * every sign in request within this time. + */ + trustDevice: z + .boolean({ + description: + "If true, the device will be trusted for 30 days. It'll be refreshed on every sign in request within this time.", + }) + .optional(), }), use: [verifyTwoFactorMiddleware], }, diff --git a/packages/stripe/src/hooks.ts b/packages/stripe/src/hooks.ts index dc62cd7ad5..2e8251dd67 100644 --- a/packages/stripe/src/hooks.ts +++ b/packages/stripe/src/hooks.ts @@ -96,15 +96,12 @@ export async function onSubscriptionUpdated( const plan = await getPlanByPriceId(options, priceId); const referenceId = subscriptionUpdated.metadata?.referenceId; - const subscriptionId = subscriptionUpdated.id; const customerId = subscriptionUpdated.customer.toString(); let subscription = await ctx.context.adapter.findOne({ model: "subscription", where: referenceId ? [{ field: "referenceId", value: referenceId }] - : subscriptionId - ? [{ field: "stripeSubscriptionId", value: subscriptionId }] - : [], + : [{ field: "stripeSubscriptionId", value: subscriptionUpdated.id }], }); if (!subscription) { const subs = await ctx.context.adapter.findMany({