diff options
| author | Mohamed Bassem <me@mbassem.com> | 2026-02-01 17:20:17 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-02-01 17:20:17 +0000 |
| commit | 4051594b2f410f01e883febad22eb9001a84f90e (patch) | |
| tree | 37b74d93192e2399fb50a31436150ba671b2b5cc /packages/trpc/models | |
| parent | 67501ed6229a63efc29b34513fac35239bd4f8e4 (diff) | |
| download | karakeep-4051594b2f410f01e883febad22eb9001a84f90e.tar.zst | |
feat: add support for redirectUrl after signup (#2439)
* feat: add support for redirectUrl after signup
* pr review
* more fixes
* format
* another fix
Diffstat (limited to 'packages/trpc/models')
| -rw-r--r-- | packages/trpc/models/users.ts | 12 |
1 files changed, 9 insertions, 3 deletions
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<typeof zSignUpSchema>, + input: z.infer<typeof zSignUpSchema> & { 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<void> { 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({ |
