Move proxyauth page to vite
This commit is contained in:
+9
-8
@@ -15,7 +15,6 @@ const apps = require('./apps.js'),
|
||||
constants = require('./constants.js'),
|
||||
dashboard = require('./dashboard.js'),
|
||||
debug = require('debug')('box:proxyAuth'),
|
||||
ejs = require('ejs'),
|
||||
express = require('express'),
|
||||
fs = require('fs'),
|
||||
hat = require('./hat.js'),
|
||||
@@ -123,11 +122,11 @@ async function login(req, res, next) {
|
||||
|
||||
const dashboardFqdn = (await dashboard.getLocation()).fqdn;
|
||||
const options = {
|
||||
oidcEndpoint: `https://${dashboardFqdn}`,
|
||||
loginUrl: `https://${dashboardFqdn}/openid/auth?client_id=${appId}&scope=openid profile email&response_type=code&redirect_uri=https://${app.fqdn}/callback`,
|
||||
iconUrl: `https://${dashboardFqdn}${app.iconUrl}`,
|
||||
name: app.label || app.fqdn,
|
||||
footer: marked.parse(await branding.renderFooter())
|
||||
OIDC_ENDPOINT: `https://${dashboardFqdn}`,
|
||||
LOGIN_URL: `https://${dashboardFqdn}/openid/auth?client_id=${appId}&scope=openid profile email&response_type=code&redirect_uri=https://${app.fqdn}/callback`,
|
||||
ICON_URL: `https://${dashboardFqdn}${app.iconUrl}`,
|
||||
NAME: app.label || app.fqdn,
|
||||
FOOTER: marked.parse(await branding.renderFooter())
|
||||
};
|
||||
|
||||
if (req.query.redirect) {
|
||||
@@ -139,8 +138,10 @@ async function login(req, res, next) {
|
||||
}
|
||||
|
||||
const translationAssets = await translations.getTranslations();
|
||||
const template = fs.readFileSync(__dirname + '/oidc_templates/proxyauth_login.ejs', 'utf-8');
|
||||
const html = ejs.render(translations.translate(template, translationAssets), options);
|
||||
let html = translations.translate(fs.readFileSync(__dirname + '/../dashboard/proxyauth_login.html', 'utf-8'), translationAssets);
|
||||
Object.keys(options).forEach(key => {
|
||||
html = html.replaceAll(`##${key}##`, options[key]);
|
||||
});
|
||||
|
||||
return res.send(html);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user