You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import{Injectable}from'@nestjs/common';import{I18nService}from'nestjs-i18n';import{ConfigService}from'@nestjs/config';import{render}from'squirrelly';importresetTemplatefrom'../../../templates/email/PasswordResetEmail';importinviteTemplatefrom'../../../templates/email/Invitation';import{Credentials,sendEmail}from'./helpers/email-helpers';import{moduleConfig}from'./config';
@Injectable()exportdefaultclassEmailService{// SES credentialsprivatereadonlycredentials: Credentials={region: this.configService.getOrThrow<string>('AWS_MAIN_REGION'),accessKeyId: this.configService.getOrThrow<string>('AWS_ADMIN_ACCESS_KEY_ID',),secretAccessKey: this.configService.getOrThrow<string>('AWS_ADMIN_SECRET_ACCESS_KEY',),};constructor(privatereadonlyi18nService: I18nService,privatereadonlyconfigService: ConfigService,){}/** * Send a custom e-mail invitation to a newly created user. * * @param recipient - e-mail of the new user * @param lang - user's language * @param [tempPassword] - user's temporary password */asyncsendCustomInviteEmail(recipient: string,lang: string,tempPassword?: string,): Promise<void>{// TODO: Implemenet application specific// Get sender from module configurationconstsender=moduleConfig().emailAddress;consttemplate: string|undefined=inviteTemplate[lang];if(template===undefined){thrownewError(`No invite email template for language ${lang}`);}// Send actual e-mailawaitsendEmail(this.credentials,sender,recipient,this.i18nService.t('authentication.invitation',{
lang,}),// E-mail contents from HTML templaterender(template,{password: tempPassword,})asstring,);}/** * Sends an e-mail notifying the user that their password was reset, containing their new temporary password * * @param recipient - e-mail recipient * @param lang - language * @param tempPassword - temporary password */asyncsendPasswordResetEmail(recipient: string,lang: string,tempPassword: string,): Promise<void>{// Get sender from module configurationconstsender=moduleConfig().emailAddress;consttemplate: string|undefined=resetTemplate[lang];if(template===undefined){thrownewError(`No password reset template for language ${lang}`);}// Send actual e-mailawaitsendEmail(this.credentials,sender,recipient,this.i18nService.t('authentication.password_reset',{
lang,}),// E-mail contents from HTML templaterender(template,{password: tempPassword,})asstring,);}}
ecf8a94aeaaf71079224d05a604533f2e73e44e7
The text was updated successfully, but these errors were encountered:
Implemenet application specific
flox/backend/src/flox/modules/email/email.service.ts
Line 42 in 4d186fe
ecf8a94aeaaf71079224d05a604533f2e73e44e7
The text was updated successfully, but these errors were encountered: