summary refs log tree commit diff
path: root/src/util
diff options
context:
space:
mode:
authorPuyodead1 <puyodead@protonmail.com>2023-02-24 06:52:01 -0500
committerPuyodead1 <puyodead@protonmail.com>2023-02-24 06:52:01 -0500
commit91e9d6004066fcb533ae95d2789a1c1b3533d0ac (patch)
tree1d22cd75635af4159312537c0a309c605781dba3 /src/util
parentdon't return token on register if verification required (diff)
downloadserver-91e9d6004066fcb533ae95d2789a1c1b3533d0ac.tar.xz
first batch of requested changes
Diffstat (limited to 'src/util')
-rw-r--r--src/util/util/Email.ts11
1 files changed, 6 insertions, 5 deletions
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<nodemailer.Transporter<unknown> | 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",