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