Fixed OIDC loop when using local authentication. Removed default auth setting for mail.js. Updated dependencies

This commit is contained in:
Glenn de Haan
2025-12-01 18:29:55 +01:00
parent 7bffaa4ebb
commit 5b672ede8b
3 changed files with 31 additions and 17 deletions

View File

@@ -52,13 +52,16 @@ module.exports = {
if(variables.authOidcEnabled) { if(variables.authOidcEnabled) {
oidc = req.oidc.isAuthenticated(); oidc = req.oidc.isAuthenticated();
// Retrieve user info/verify user session is still valid // Check if OIDC is used to authenticate
req.user = await req.oidc.fetchUserInfo().catch(() => { if(oidc) {
res.redirect(302, `${req.headers['x-ingress-path'] ? req.headers['x-ingress-path'] : ''}/login`); // Retrieve user info/verify user session is still valid
}); req.user = await req.oidc.fetchUserInfo().catch(() => {
res.redirect(302, `${req.headers['x-ingress-path'] ? req.headers['x-ingress-path'] : ''}/login`);
});
if(!req.user) { if (!req.user) {
return; return;
}
} }
} }

View File

@@ -20,20 +20,31 @@ const time = require('../utils/time');
const bytes = require('../utils/bytes'); const bytes = require('../utils/bytes');
/** /**
* Create nodemailer transport * Base SMTP config
*/ */
const transport = nodemailer.createTransport({ const smtpConfig = {
host: variables.smtpHost, host: variables.smtpHost,
port: parseInt(variables.smtpPort), port: parseInt(variables.smtpPort),
secure: variables.smtpSecure, secure: variables.smtpSecure,
tls: { tls: {
rejectUnauthorized: false // Skip TLS Certificate checks for Self-Hosted systems rejectUnauthorized: false // Skip TLS Certificate checks for Self-Hosted systems
}, }
auth: { };
/**
* Include SMTP auth if defined
*/
if(variables.smtpUsername !== '' && variables.smtpPassword !== '') {
smtpConfig.auth = {
user: variables.smtpUsername, user: variables.smtpUsername,
pass: variables.smtpPassword pass: variables.smtpPassword
} };
}); }
/**
* Create nodemailer transport
*/
const transport = nodemailer.createTransport(smtpConfig);
/** /**
* Mail module functions * Mail module functions

View File

@@ -17,21 +17,21 @@
"dependencies": { "dependencies": {
"cookie-parser": "^1.4.7", "cookie-parser": "^1.4.7",
"ejs": "^3.1.10", "ejs": "^3.1.10",
"express": "^5.1.0", "express": "^5.2.0",
"express-locale": "^2.0.2", "express-locale": "^2.0.2",
"express-openid-connect": "^2.19.2", "express-openid-connect": "^2.19.3",
"js-logger": "^1.6.1", "js-logger": "^1.6.1",
"jsonwebtoken": "^9.0.2", "jsonwebtoken": "^9.0.2",
"multer": "^2.0.2", "multer": "^2.0.2",
"node-thermal-printer": "^4.5.0", "node-thermal-printer": "^4.5.0",
"nodemailer": "^7.0.10", "nodemailer": "^7.0.11",
"pdfkit": "^0.17.2", "pdfkit": "^0.17.2",
"qrcode": "^1.5.4", "qrcode": "^1.5.4",
"undici": "^7.16.0" "undici": "^7.16.0"
}, },
"devDependencies": { "devDependencies": {
"@tailwindcss/cli": "^4.1.16", "@tailwindcss/cli": "^4.1.17",
"@tailwindcss/forms": "^0.5.10", "@tailwindcss/forms": "^0.5.10",
"tailwindcss": "^4.1.16" "tailwindcss": "^4.1.17"
} }
} }