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(
31
31
super ( {
32
32
secret : MAGIC_LINK_SECRET ,
33
33
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` ,
35
35
sendMagicLink : MagicLinkEmailStrategy . sendMagicLink (
36
36
SERVER_URL ,
37
37
userService ,
@@ -53,18 +53,14 @@ export class MagicLinkEmailStrategy extends PassportStrategy(
53
53
mailingService : MailingService ,
54
54
) =>
55
55
async ( email : string , magicLink : string ) => {
56
- const user = await userService . findByEmail ( email ) ;
56
+ let user = await userService . findByEmail ( email ) ;
57
57
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 ) ;
62
61
63
62
const context = {
64
- magicLink : magicLink . replace (
65
- 'undefined' ,
66
- SERVER_URL + '/api/v1/auth/magic-link/callback' ,
67
- ) ,
63
+ magicLink : magicLink ,
68
64
username : user . username ,
69
65
} ;
70
66
You can’t perform that action at this time.
0 commit comments