feature/refactor-login #19
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue