From 91e9d6004066fcb533ae95d2789a1c1b3533d0ac Mon Sep 17 00:00:00 2001 From: Puyodead1 Date: Fri, 24 Feb 2023 06:52:01 -0500 Subject: first batch of requested changes --- src/util/util/Email.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/util') diff --git a/src/util/util/Email.ts b/src/util/util/Email.ts index fa72d9c0..714b3db2 100644 --- a/src/util/util/Email.ts +++ b/src/util/util/Email.ts @@ -52,7 +52,9 @@ export function adjustEmail(email?: string): string | undefined { // return email; } -const transporters = { +const transporters: { + [key: string]: () => Promise | void>; +} = { smtp: async function () { // get configuration const { host, port, secure, username, password } = @@ -223,8 +225,7 @@ export const Email: { const { provider } = Config.get().email; if (!provider) return; - const transporterFn = - transporters[provider as keyof typeof transporters]; + const transporterFn = transporters[provider]; if (!transporterFn) return console.error(`[Email] Invalid provider: ${provider}`); console.log(`[Email] Initializing ${provider} transport...`); @@ -346,7 +347,7 @@ export const Email: { const link = await this.generateLink("reset", user.id, email); // load the email template - const rawTemplate = fs.readFileSync( + const rawTemplate = await fs.promises.readFile( path.join( ASSET_FOLDER_PATH, "email_templates", @@ -380,7 +381,7 @@ export const Email: { if (!this.transporter) return; // load the email template - const rawTemplate = fs.readFileSync( + const rawTemplate = await fs.promises.readFile( path.join( ASSET_FOLDER_PATH, "email_templates", -- cgit 1.5.1