diff --git a/backend/src/email/email.service.ts b/backend/src/email/email.service.ts index e6a6231..389d002 100644 --- a/backend/src/email/email.service.ts +++ b/backend/src/email/email.service.ts @@ -7,15 +7,17 @@ import { ConfigService } from "src/config/config.service"; export class EmailService { constructor(private config: ConfigService) {} - transporter = nodemailer.createTransport({ - host: this.config.get("SMTP_HOST"), - port: parseInt(this.config.get("SMTP_PORT")), - secure: parseInt(this.config.get("SMTP_PORT")) == 465, - auth: { - user: this.config.get("SMTP_USERNAME"), - pass: this.config.get("SMTP_PASSWORD"), - }, - }); + getTransporter() { + return nodemailer.createTransport({ + host: this.config.get("SMTP_HOST"), + port: parseInt(this.config.get("SMTP_PORT")), + secure: parseInt(this.config.get("SMTP_PORT")) == 465, + auth: { + user: this.config.get("SMTP_USERNAME"), + pass: this.config.get("SMTP_PASSWORD"), + }, + }); + } async sendMail(recipientEmail: string, shareId: string, creator: User) { if (!this.config.get("ENABLE_EMAIL_RECIPIENTS")) @@ -23,7 +25,7 @@ export class EmailService { const shareUrl = `${this.config.get("APP_URL")}/share/${shareId}`; - await this.transporter.sendMail({ + await this.getTransporter().sendMail({ from: `"Pingvin Share" <${this.config.get("SMTP_EMAIL")}>`, to: recipientEmail, subject: this.config.get("EMAIL_SUBJECT"), @@ -36,7 +38,7 @@ export class EmailService { } async sendTestMail(recipientEmail: string) { - await this.transporter.sendMail({ + await this.getTransporter().sendMail({ from: `"Pingvin Share" <${this.config.get("SMTP_EMAIL")}>`, to: recipientEmail, subject: "Test email", diff --git a/frontend/src/components/admin/configuration/AdminConfigInput.tsx b/frontend/src/components/admin/configuration/AdminConfigInput.tsx index 1a23d90..3e5a33b 100644 --- a/frontend/src/components/admin/configuration/AdminConfigInput.tsx +++ b/frontend/src/components/admin/configuration/AdminConfigInput.tsx @@ -36,8 +36,8 @@ const AdminConfigInput = ({ (configVariable.obscured ? ( onValueChange(configVariable, e.target.value)} {...form.getInputProps("stringValue")} + onChange={(e) => onValueChange(configVariable, e.target.value)} /> ) : (