Skip to content

Commit

Permalink
Conditionally add auth only if credentials are set
Browse files Browse the repository at this point in the history
Signed-off-by: Ivan Polchenko <[email protected]>
  • Loading branch information
i5okie committed Feb 5, 2024
1 parent c7ab45c commit ae1e4e9
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions services/tenant-ui/src/components/email.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,23 @@ export const sendConfirmationEmail = async (req: Request) => {
*/
export const sendStatusEmail = async (req: Request) => {
try {
const transporter = nodemailer.createTransport({

// Prepare the transport configuration
let transportConfig = {

Check failure on line 78 in services/tenant-ui/src/components/email.ts

View workflow job for this annotation

GitHub Actions / Build Tenant UI

'transportConfig' is never reassigned. Use 'const' instead
host: SERVER,
port: PORT,
secure: SECURE,
auth: {
};

// Add auth only if user and password are set
if (USER !== "" && PASSWORD !== "") {
transportConfig.auth = {
user: USER,
pass: PASSWORD,
},
});
};
}

const transporter = nodemailer.createTransport(transportConfig);

let template;
let subject;
Expand Down

0 comments on commit ae1e4e9

Please sign in to comment.