@@ -121,8 +121,8 @@ export class Mailer {
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Function for sending a reset mail from the reset mail template.
 | 
			
		||||
     * @param to_address The address the mail will be sent to. Should always get pulled from a user object.
 | 
			
		||||
     * @param token The requested password reset token - will be combined with the app_url to generate a password reset link.
 | 
			
		||||
     * @param to_address The address the mail will be sent to. Should always get pulled from a runner object.
 | 
			
		||||
     * @param token The runner's selfservice token - will be combined with the app_url to generate a selfservice profile link.
 | 
			
		||||
     */
 | 
			
		||||
    public async sendWelcomeMail(to_address: string, token: string, locale: string = "en") {
 | 
			
		||||
        await i18next.changeLanguage(locale);
 | 
			
		||||
@@ -152,6 +152,39 @@ export class Mailer {
 | 
			
		||||
        await this.sendMail(mail);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Function for sending a selfservice link forgotten mail from the runner_forgot template.
 | 
			
		||||
     * @param to_address The address the mail will be sent to. Should always get pulled from a runner object.
 | 
			
		||||
     * @param token The runner's selfservice token - will be combined with the app_url to generate a selfservice profile link.
 | 
			
		||||
     */
 | 
			
		||||
    public async sendSelfserviceForgottenMail(to_address: string, token: string, locale: string = "en") {
 | 
			
		||||
        await i18next.changeLanguage(locale);
 | 
			
		||||
 | 
			
		||||
        const replacements = {
 | 
			
		||||
            recipient_mail: to_address,
 | 
			
		||||
            copyright_owner: config.copyright_owner,
 | 
			
		||||
            link_imprint: `${config.app_url}/imprint`,
 | 
			
		||||
            link_privacy: `${config.app_url}/privacy`,
 | 
			
		||||
            selfservice_link: `${config.app_url}/selfservice/profile/${token}`,
 | 
			
		||||
            forgot_link: `${config.app_url}/selfservice`,
 | 
			
		||||
            contact_mail: config.contact_mail,
 | 
			
		||||
            event_name: config.event_name
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        const template_html = Handlebars.compile(fs.readFileSync(__dirname + '/templates/runner_forgot.html', { encoding: 'utf8' }));
 | 
			
		||||
        const template_txt = Handlebars.compile(fs.readFileSync(__dirname + '/templates/runner_forgot.txt', { encoding: 'utf8' }));
 | 
			
		||||
        const body_html = template_html(replacements);
 | 
			
		||||
        const body_txt = template_txt(replacements);
 | 
			
		||||
 | 
			
		||||
        const mail: MailOptions = {
 | 
			
		||||
            to: to_address,
 | 
			
		||||
            subject: i18next.t("your-event_name-profile", Mailer.interpolations).toString(),
 | 
			
		||||
            text: body_txt,
 | 
			
		||||
            html: body_html
 | 
			
		||||
        };
 | 
			
		||||
        await this.sendMail(mail);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Wrapper function for sending a mail via this object's transporter.
 | 
			
		||||
     * @param mail MailOptions object containing the 
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user