feature/refactor-login #19

Merged
igorpropisnov merged 26 commits from feature/refactor-login into main 2024-09-19 13:58:12 +02:00
1 changed files with 8 additions and 3 deletions
Showing only changes of commit dff76010d9 - Show all commits

View File

@ -10,6 +10,7 @@ import { TemplateConfigService } from './template-config.service';
export class PasswordConfirmationMailService extends BaseMailService {
private readonly PASSWORD_CONFIRMATION_EMAIL: string =
'PASSWORD_CONFIRMATION_EMAIL';
private readonly REGISTER_EMAIL: string = 'REGISTER_EMAIL';
public constructor(
@Inject('SEND_GRID_API_KEY') protected readonly sendGridApiKey: string,
@ -66,13 +67,17 @@ export class PasswordConfirmationMailService extends BaseMailService {
): Promise<void> {
const token = `${registrationToken}|${UriEncoderService.encodeBase64(to)}`;
const registrationLink = `${this.configService.get<string>('APP_URL')}/?token=${token}&signup=true`;
const templateId: string = this.templateConfigService.getTemplateId(
this.REGISTER_EMAIL
);
const mailoptions: SendGridMailApi.MailDataRequired = {
to,
from: { email: 'info@igor-propisnov.com', name: 'Ticket App' },
subject: 'Complete Your Registration',
text: `Click this link to complete your registration: ${registrationLink}`,
html: `<p>Click <a href="${registrationLink}">here</a> to complete your registration.</p>`,
templateId: templateId,
dynamicTemplateData: {
buttonUrl: registrationLink,
},
};
await this.sendMail(mailoptions);