File tree Expand file tree Collapse file tree 4 files changed +13
-8
lines changed Expand file tree Collapse file tree 4 files changed +13
-8
lines changed Original file line number Diff line number Diff line change @@ -65,7 +65,7 @@ export class Auth0Service {
65
65
async createVerificationEmailTicket (
66
66
accessToken : string ,
67
67
auth0UserId : string ,
68
- ) : Promise < Auth0Response > {
68
+ ) {
69
69
try {
70
70
const [ provider , userId ] = auth0UserId . split ( '|' ) ;
71
71
const payload = {
@@ -77,7 +77,8 @@ export class Auth0Service {
77
77
const options = {
78
78
method : 'POST' ,
79
79
headers : {
80
- 'Authorization' : `Bearer ${ accessToken } ` ,
80
+ /* tslint:disable-next-line */
81
+ Authorization : `Bearer ${ accessToken } ` ,
81
82
'content-type' : 'application/json' ,
82
83
} ,
83
84
body : JSON . stringify ( payload ) ,
Original file line number Diff line number Diff line change @@ -15,7 +15,8 @@ export class UsersService {
15
15
16
16
async create ( userDto : UserDto ) : Promise < User > {
17
17
const user = new this . userModel ( userDto ) ;
18
- return await user . save ( ) ;
18
+ const result = await user . save ( ) ;
19
+ return result . toObject ( ) ;
19
20
}
20
21
21
22
async findById ( _id : string ) : Promise < User > {
Original file line number Diff line number Diff line change @@ -20,9 +20,10 @@ interface WelcomePayload {
20
20
}
21
21
22
22
interface VerificationEmailPayload {
23
- name : 'verification- email' ;
23
+ name : 'email-verification ' ;
24
24
data : {
25
- ticket : string ;
25
+ name : string ;
26
+ link : string ;
26
27
} ;
27
28
}
28
29
Original file line number Diff line number Diff line change @@ -406,10 +406,12 @@ export class UsersController {
406
406
user . auth0Id ,
407
407
) ;
408
408
409
- // TODO - create email verification template
410
409
this . emailService . sendLocalTemplate ( {
411
- name : 'verification-email' ,
412
- data : response ,
410
+ name : 'email-verification' ,
411
+ data : {
412
+ name : user . name ,
413
+ link : response . ticket ,
414
+ } ,
413
415
to : user . email ,
414
416
subject : 'Verify your email' ,
415
417
} ) ;
You can’t perform that action at this time.
0 commit comments