mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Customise login image
This commit is contained in:
parent
2b8ed9850b
commit
6ff540ed08
@ -22,7 +22,7 @@ RED.user = (function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var dialog = $('<div id="node-dialog-login" class="hide">'+
|
var dialog = $('<div id="node-dialog-login" class="hide">'+
|
||||||
'<div style="display: inline-block;width: 250px; vertical-align: top; margin-right: 10px; margin-bottom: 20px;"><img src="red/images/node-red-256.png"/></div>'+
|
'<div style="display: inline-block;width: 250px; vertical-align: top; margin-right: 10px; margin-bottom: 20px;"><img id="node-dialog-login-image" src=""/></div>'+
|
||||||
'<div style="display: inline-block; width: 250px; vertical-align: bottom; margin-left: 10px; margin-bottom: 20px;">'+
|
'<div style="display: inline-block; width: 250px; vertical-align: bottom; margin-left: 10px; margin-bottom: 20px;">'+
|
||||||
'<form id="node-dialog-login-fields" class="form-horizontal" style="margin-bottom: 0px;"></form>'+
|
'<form id="node-dialog-login-fields" class="form-horizontal" style="margin-bottom: 0px;"></form>'+
|
||||||
'</div>'+
|
'</div>'+
|
||||||
@ -45,6 +45,13 @@ RED.user = (function() {
|
|||||||
success: function(data) {
|
success: function(data) {
|
||||||
if (data.type == "credentials") {
|
if (data.type == "credentials") {
|
||||||
var i=0;
|
var i=0;
|
||||||
|
|
||||||
|
if (data.image) {
|
||||||
|
$("#node-dialog-login-image").attr("src",data.image);
|
||||||
|
} else {
|
||||||
|
$("#node-dialog-login-image").attr("src","red/images/node-red-256.png");
|
||||||
|
}
|
||||||
|
|
||||||
for (;i<data.prompts.length;i++) {
|
for (;i<data.prompts.length;i++) {
|
||||||
var field = data.prompts[i];
|
var field = data.prompts[i];
|
||||||
var row = $("<div/>",{class:"form-row"});
|
var row = $("<div/>",{class:"form-row"});
|
||||||
|
@ -22,6 +22,8 @@ var Tokens = require("./tokens");
|
|||||||
var Users = require("./users");
|
var Users = require("./users");
|
||||||
var permissions = require("./permissions");
|
var permissions = require("./permissions");
|
||||||
|
|
||||||
|
var theme = require("../theme");
|
||||||
|
|
||||||
var settings = null;
|
var settings = null;
|
||||||
var log = require("../../log");
|
var log = require("../../log");
|
||||||
|
|
||||||
@ -80,6 +82,9 @@ function login(req,res) {
|
|||||||
"type":"credentials",
|
"type":"credentials",
|
||||||
"prompts":[{id:"username",type:"text",label:"Username"},{id:"password",type:"password",label:"Password"}]
|
"prompts":[{id:"username",type:"text",label:"Username"},{id:"password",type:"password",label:"Password"}]
|
||||||
}
|
}
|
||||||
|
if (theme.context().login && theme.context().login.image) {
|
||||||
|
response.image = theme.context().login.image;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
res.json(response);
|
res.json(response);
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,7 @@ function serveFile(app,baseUrl,file) {
|
|||||||
app.get(url,function(req, res) {
|
app.get(url,function(req, res) {
|
||||||
res.sendfile(file);
|
res.sendfile(file);
|
||||||
});
|
});
|
||||||
return url;
|
return "theme"+url;
|
||||||
} catch(err) {
|
} catch(err) {
|
||||||
//TODO: log filenotfound
|
//TODO: log filenotfound
|
||||||
return null;
|
return null;
|
||||||
@ -79,7 +79,7 @@ module.exports = {
|
|||||||
for (i=0;i<styles.length;i++) {
|
for (i=0;i<styles.length;i++) {
|
||||||
url = serveFile(themeApp,"/css/",styles[i]);
|
url = serveFile(themeApp,"/css/",styles[i]);
|
||||||
if (url) {
|
if (url) {
|
||||||
themeContext.page.css.push("theme"+url);
|
themeContext.page.css.push(url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -87,7 +87,7 @@ module.exports = {
|
|||||||
if (theme.page.favicon) {
|
if (theme.page.favicon) {
|
||||||
url = serveFile(themeApp,"/favicon/",theme.page.favicon)
|
url = serveFile(themeApp,"/favicon/",theme.page.favicon)
|
||||||
if (url) {
|
if (url) {
|
||||||
themeContext.page.favicon = "theme"+url;
|
themeContext.page.favicon = url;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -101,7 +101,7 @@ module.exports = {
|
|||||||
if (theme.header.image) {
|
if (theme.header.image) {
|
||||||
url = serveFile(themeApp,"/header/",theme.header.image);
|
url = serveFile(themeApp,"/header/",theme.header.image);
|
||||||
if (url) {
|
if (url) {
|
||||||
themeContext.header.image = "theme"+url;
|
themeContext.header.image = url;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
themeContext.header.image = null;
|
themeContext.header.image = null;
|
||||||
@ -120,7 +120,7 @@ module.exports = {
|
|||||||
if (theme.deployButton.icon) {
|
if (theme.deployButton.icon) {
|
||||||
url = serveFile(themeApp,"/deploy/",theme.deployButton.icon);
|
url = serveFile(themeApp,"/deploy/",theme.deployButton.icon);
|
||||||
if (url) {
|
if (url) {
|
||||||
themeSettings.deployButton.icon = "theme"+url;
|
themeSettings.deployButton.icon = url;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -131,6 +131,16 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
//themeSettings.deployButton = theme.deployButton || themeSettings.deployButton;
|
//themeSettings.deployButton = theme.deployButton || themeSettings.deployButton;
|
||||||
|
|
||||||
|
if (theme.login) {
|
||||||
|
if (theme.login.image) {
|
||||||
|
url = serveFile(themeApp,"/login/",theme.login.image);
|
||||||
|
if (url) {
|
||||||
|
themeContext.login = {
|
||||||
|
image: url
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return themeApp;
|
return themeApp;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user