File tree Expand file tree Collapse file tree 1 file changed +6
-10
lines changed
server/src/auth/strategies Expand file tree Collapse file tree 1 file changed +6
-10
lines changed Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ export class MagicLinkEmailStrategy extends PassportStrategy(
3131 super ( {
3232 secret : MAGIC_LINK_SECRET ,
3333 confirmUrl : `${ SERVER_URL } /api/v1/auth/magic-link/confirm` ,
34- callbackURL : `${ SERVER_URL } /api/v1/auth/magic-link/callback` ,
34+ callbackUrl : `${ SERVER_URL } /api/v1/auth/magic-link/callback` ,
3535 sendMagicLink : MagicLinkEmailStrategy . sendMagicLink (
3636 SERVER_URL ,
3737 userService ,
@@ -53,18 +53,14 @@ export class MagicLinkEmailStrategy extends PassportStrategy(
5353 mailingService : MailingService ,
5454 ) =>
5555 async ( email : string , magicLink : string ) => {
56- const user = await userService . findByEmail ( email ) ;
56+ let user = await userService . findByEmail ( email ) ;
5757
58- if ( ! user ) {
59- MagicLinkEmailStrategy . logger . error ( 'User not found' ) ;
60- return ;
61- }
58+ if ( ! user )
59+ // Create user if not found
60+ user = await userService . createWithEmail ( email ) ;
6261
6362 const context = {
64- magicLink : magicLink . replace (
65- 'undefined' ,
66- SERVER_URL + '/api/v1/auth/magic-link/callback' ,
67- ) ,
63+ magicLink : magicLink ,
6864 username : user . username ,
6965 } ;
7066
You can’t perform that action at this time.
0 commit comments