From 4051594b2f410f01e883febad22eb9001a84f90e Mon Sep 17 00:00:00 2001 From: Mohamed Bassem Date: Sun, 1 Feb 2026 17:20:17 +0000 Subject: feat: add support for redirectUrl after signup (#2439) * feat: add support for redirectUrl after signup * pr review * more fixes * format * another fix --- packages/trpc/models/users.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'packages/trpc/models') diff --git a/packages/trpc/models/users.ts b/packages/trpc/models/users.ts index 5d3c3785..671f7d74 100644 --- a/packages/trpc/models/users.ts +++ b/packages/trpc/models/users.ts @@ -61,7 +61,7 @@ export class User { static async create( ctx: Context, - input: z.infer, + input: z.infer & { redirectUrl?: string }, role?: "user" | "admin", ) { const salt = generatePasswordSalt(); @@ -76,7 +76,12 @@ export class User { if (serverConfig.auth.emailVerificationRequired) { const token = await User.genEmailVerificationToken(ctx.db, input.email); try { - await sendVerificationEmail(input.email, input.name, token); + await sendVerificationEmail( + input.email, + input.name, + token, + input.redirectUrl, + ); } catch (error) { console.error("Failed to send verification email:", error); } @@ -227,6 +232,7 @@ export class User { static async resendVerificationEmail( ctx: Context, email: string, + redirectUrl?: string, ): Promise { if ( !serverConfig.auth.emailVerificationRequired || @@ -255,7 +261,7 @@ export class User { const token = await User.genEmailVerificationToken(ctx.db, email); try { - await sendVerificationEmail(email, user.name, token); + await sendVerificationEmail(email, user.name, token, redirectUrl); } catch (error) { console.error("Failed to send verification email:", error); throw new TRPCError({ -- cgit v1.2.3-70-g09d2