Skip to content

Commit d309b96

Browse files
committed
complete email verification template
1 parent 2e51633 commit d309b96

File tree

4 files changed

+13
-8
lines changed

4 files changed

+13
-8
lines changed

src/modules/common/auth0/auth0.service.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ export class Auth0Service {
6565
async createVerificationEmailTicket(
6666
accessToken: string,
6767
auth0UserId: string,
68-
): Promise<Auth0Response> {
68+
) {
6969
try {
7070
const [provider, userId] = auth0UserId.split('|');
7171
const payload = {
@@ -77,7 +77,8 @@ export class Auth0Service {
7777
const options = {
7878
method: 'POST',
7979
headers: {
80-
'Authorization': `Bearer ${accessToken}`,
80+
/* tslint:disable-next-line */
81+
Authorization: `Bearer ${accessToken}`,
8182
'content-type': 'application/json',
8283
},
8384
body: JSON.stringify(payload),

src/modules/common/users.service.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ export class UsersService {
1515

1616
async create(userDto: UserDto): Promise<User> {
1717
const user = new this.userModel(userDto);
18-
return await user.save();
18+
const result = await user.save();
19+
return result.toObject();
1920
}
2021

2122
async findById(_id: string): Promise<User> {

src/modules/email/interfaces/email.interface.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,10 @@ interface WelcomePayload {
2020
}
2121

2222
interface VerificationEmailPayload {
23-
name: 'verification-email';
23+
name: 'email-verification';
2424
data: {
25-
ticket: string;
25+
name: string;
26+
link: string;
2627
};
2728
}
2829

src/modules/users/users.controller.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -406,10 +406,12 @@ export class UsersController {
406406
user.auth0Id,
407407
);
408408

409-
// TODO - create email verification template
410409
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+
},
413415
to: user.email,
414416
subject: 'Verify your email',
415417
});

0 commit comments

Comments
 (0)