1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Ensure theme login image is passed through to api response

Fixes #2929
This commit is contained in:
Nick O'Leary 2021-04-12 10:05:44 +01:00
parent 4672d98e8a
commit 13406e76de
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9

View File

@ -90,7 +90,7 @@ function getToken(req,res,next) {
return server.token()(req,res,next); return server.token()(req,res,next);
} }
function login(req,res) { async function login(req,res) {
var response = {}; var response = {};
if (settings.adminAuth) { if (settings.adminAuth) {
var mergedAdminAuth = Object.assign({}, settings.adminAuth, settings.adminAuth.module); var mergedAdminAuth = Object.assign({}, settings.adminAuth, settings.adminAuth.module);
@ -116,8 +116,9 @@ function login(req,res) {
response.prompts[0].image = theme.serveFile('/login/',mergedAdminAuth.strategy.image); response.prompts[0].image = theme.serveFile('/login/',mergedAdminAuth.strategy.image);
} }
} }
if (theme.context().login && theme.context().login.image) { let themeContext = await theme.context();
response.image = theme.context().login.image; if (themeContext.login && themeContext.login.image) {
response.image = themeContext.login.image;
} }
} }
res.json(response); res.json(response);