Move login.ejs into a vite handled view
This commit is contained in:
22
src/oidc.js
22
src/oidc.js
@@ -481,20 +481,24 @@ function renderInteractionPage(provider) {
|
||||
switch (prompt.name) {
|
||||
case 'login': {
|
||||
const options = {
|
||||
submitUrl: `${ROUTE_PREFIX}/interaction/${uid}/login`,
|
||||
iconUrl: '/api/v1/cloudron/avatar',
|
||||
name: client?.name || await branding.getCloudronName(),
|
||||
footer: marked.parse(await branding.renderFooter()),
|
||||
note: (client.id === tokens.ID_WEBADMIN && constants.DEMO) ? '<div style="text-align: center;">This is a demo. Username and password is "cloudron"</div>' : ''
|
||||
SUBMIT_URL: `${ROUTE_PREFIX}/interaction/${uid}/login`,
|
||||
ICON_URL: '/api/v1/cloudron/avatar',
|
||||
NAME: client?.name || await branding.getCloudronName(),
|
||||
FOOTER: marked.parse(await branding.renderFooter()),
|
||||
NOTE: (client.id === tokens.ID_WEBADMIN && constants.DEMO) ? '<div style="text-align: center;">This is a demo. Username and password is "cloudron"</div>' : ''
|
||||
};
|
||||
|
||||
if (app) {
|
||||
options.name = app.label || app.fqdn;
|
||||
options.iconUrl = app.iconUrl;
|
||||
options.NAME = app.label || app.fqdn;
|
||||
options.ICON_URL = app.iconUrl;
|
||||
}
|
||||
|
||||
const template = fs.readFileSync(__dirname + '/oidc_templates/login.ejs', 'utf-8');
|
||||
const html = ejs.render(translations.translate(template, translationAssets), options);
|
||||
// great ejs replacement!
|
||||
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');
|
||||
});
|
||||
|
||||
return res.send(html);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user