fix: mail context vars

This commit is contained in:
Mohamed Marrouchi 2025-03-21 01:18:22 +01:00
parent ba4305a5c2
commit 3d320954d4
3 changed files with 14 additions and 5 deletions

View File

@ -6,6 +6,8 @@
* 2. All derivative works must include clear attribution to the original creator and software, Hexastack and Hexabot, in a prominent location (e.g., in the software's "About" section, documentation, and README file). * 2. All derivative works must include clear attribution to the original creator and software, Hexastack and Hexabot, in a prominent location (e.g., in the software's "About" section, documentation, and README file).
*/ */
// eslint-disable-next-line import/order
import { MailerService } from '@nestjs-modules/mailer';
import { import {
Inject, Inject,
Injectable, Injectable,
@ -13,7 +15,6 @@ import {
Optional, Optional,
} from '@nestjs/common'; } from '@nestjs/common';
import { JwtService, JwtSignOptions } from '@nestjs/jwt'; import { JwtService, JwtSignOptions } from '@nestjs/jwt';
import { MailerService } from '@nestjs-modules/mailer';
import { config } from '@/config'; import { config } from '@/config';
import { I18nService } from '@/i18n/services/i18n.service'; import { I18nService } from '@/i18n/services/i18n.service';
@ -69,6 +70,8 @@ export class InvitationService extends BaseService<
to: dto.email, to: dto.email,
template: 'invitation.mjml', template: 'invitation.mjml',
context: { context: {
appName: config.parameters.appName,
appUrl: config.uiBaseUrl,
token: jwt, token: jwt,
// TODO: Which language should we use? // TODO: Which language should we use?
t: (key: string) => t: (key: string) =>

View File

@ -1,11 +1,13 @@
/* /*
* Copyright © 2024 Hexastack. All rights reserved. * Copyright © 2025 Hexastack. All rights reserved.
* *
* Licensed under the GNU Affero General Public License v3.0 (AGPLv3) with the following additional terms: * Licensed under the GNU Affero General Public License v3.0 (AGPLv3) with the following additional terms:
* 1. The name "Hexabot" is a trademark of Hexastack. You may not use this name in derivative works without express written permission. * 1. The name "Hexabot" is a trademark of Hexastack. You may not use this name in derivative works without express written permission.
* 2. All derivative works must include clear attribution to the original creator and software, Hexastack and Hexabot, in a prominent location (e.g., in the software's "About" section, documentation, and README file). * 2. All derivative works must include clear attribution to the original creator and software, Hexastack and Hexabot, in a prominent location (e.g., in the software's "About" section, documentation, and README file).
*/ */
// eslint-disable-next-line import/order
import { MailerService } from '@nestjs-modules/mailer';
import { import {
BadRequestException, BadRequestException,
Inject, Inject,
@ -16,7 +18,6 @@ import {
UnauthorizedException, UnauthorizedException,
} from '@nestjs/common'; } from '@nestjs/common';
import { JwtService, JwtSignOptions } from '@nestjs/jwt'; import { JwtService, JwtSignOptions } from '@nestjs/jwt';
import { MailerService } from '@nestjs-modules/mailer';
import { compareSync } from 'bcryptjs'; import { compareSync } from 'bcryptjs';
import { config } from '@/config'; import { config } from '@/config';
@ -66,6 +67,8 @@ export class PasswordResetService {
to: dto.email, to: dto.email,
template: 'password_reset.mjml', template: 'password_reset.mjml',
context: { context: {
appName: config.parameters.appName,
appUrl: config.uiBaseUrl,
token: jwt, token: jwt,
first_name: user.first_name, first_name: user.first_name,
t: (key: string) => t: (key: string) =>

View File

@ -1,11 +1,13 @@
/* /*
* Copyright © 2024 Hexastack. All rights reserved. * Copyright © 2025 Hexastack. All rights reserved.
* *
* Licensed under the GNU Affero General Public License v3.0 (AGPLv3) with the following additional terms: * Licensed under the GNU Affero General Public License v3.0 (AGPLv3) with the following additional terms:
* 1. The name "Hexabot" is a trademark of Hexastack. You may not use this name in derivative works without express written permission. * 1. The name "Hexabot" is a trademark of Hexastack. You may not use this name in derivative works without express written permission.
* 2. All derivative works must include clear attribution to the original creator and software, Hexastack and Hexabot, in a prominent location (e.g., in the software's "About" section, documentation, and README file). * 2. All derivative works must include clear attribution to the original creator and software, Hexastack and Hexabot, in a prominent location (e.g., in the software's "About" section, documentation, and README file).
*/ */
// eslint-disable-next-line import/order
import { MailerService } from '@nestjs-modules/mailer';
import { import {
Inject, Inject,
Injectable, Injectable,
@ -14,7 +16,6 @@ import {
UnauthorizedException, UnauthorizedException,
} from '@nestjs/common'; } from '@nestjs/common';
import { JwtService, JwtSignOptions } from '@nestjs/jwt'; import { JwtService, JwtSignOptions } from '@nestjs/jwt';
import { MailerService } from '@nestjs-modules/mailer';
import { config } from '@/config'; import { config } from '@/config';
import { I18nService } from '@/i18n/services/i18n.service'; import { I18nService } from '@/i18n/services/i18n.service';
@ -83,6 +84,8 @@ export class ValidateAccountService {
to: dto.email, to: dto.email,
template: 'account_confirmation.mjml', template: 'account_confirmation.mjml',
context: { context: {
appName: config.parameters.appName,
appUrl: config.uiBaseUrl,
token: confirmationToken, token: confirmationToken,
first_name: dto.first_name, first_name: dto.first_name,
t: (key: string) => t: (key: string) =>