diff --git a/src/oidc_templates/error.ejs b/dashboard/oidc_error.html similarity index 95% rename from src/oidc_templates/error.ejs rename to dashboard/oidc_error.html index 02b7b8874..1ec2795b7 100644 --- a/src/oidc_templates/error.ejs +++ b/dashboard/oidc_error.html @@ -62,14 +62,14 @@
- <%= errorMessage %> + ##ERROR_MESSAGE##
diff --git a/dashboard/vite.config.mjs b/dashboard/vite.config.mjs index 32bd6c44e..65d6f4308 100644 --- a/dashboard/vite.config.mjs +++ b/dashboard/vite.config.mjs @@ -24,6 +24,7 @@ export default defineConfig({ filemanager: resolve('filemanager.html'), index: resolve('index.html'), login: resolve('login.html'), + oidc_error: resolve('oidc_error.html'), logs: resolve('logs.html'), notfound: resolve('notfound.html'), passwordreset: resolve('passwordreset.html'), diff --git a/src/oidc.js b/src/oidc.js index 17916f373..7c49f9c41 100644 --- a/src/oidc.js +++ b/src/oidc.js @@ -497,7 +497,7 @@ function renderInteractionPage(provider) { const template = fs.readFileSync(__dirname + '/../dashboard/login.html', 'utf-8'); let html = translations.translate(template, translationAssets); Object.keys(options).forEach(key => { - html = html.replace(`##${key}##`, options[key], 'g'); + html = html.replaceAll(`##${key}##`, options[key]); }); return res.send(html); @@ -763,14 +763,18 @@ async function findAccount(ctx, id) { async function renderError(ctx, out, error) { const data = { - errorMessage: error.error_description || error.error_detail || 'Unknown error', - footer: marked.parse(await branding.renderFooter()) + ERROR_MESSAGE: error.error_description || error.error_detail || 'Unknown error', + FOOTER: marked.parse(await branding.renderFooter()) }; debug('renderError: %o', error); + let html = fs.readFileSync(path.join(__dirname, '/..dashboard/oidc_error.html'), 'utf8'); + Object.keys(data).forEach(key => { + html = html.replaceAll(`##${key}##`, data[key]); + }); ctx.type = 'html'; - ctx.body = ejs.render(fs.readFileSync(path.join(__dirname, 'oidc_templates/error.ejs'), 'utf8'), data, {}); + ctx.body = html; } async function start() {