Customise login image

This commit is contained in:
Nick O'Leary
2015-04-13 10:37:30 +01:00
parent 2b8ed9850b
commit 6ff540ed08
3 changed files with 28 additions and 6 deletions

View File

@@ -22,6 +22,8 @@ var Tokens = require("./tokens");
var Users = require("./users");
var permissions = require("./permissions");
var theme = require("../theme");
var settings = null;
var log = require("../../log");
@@ -80,6 +82,9 @@ function login(req,res) {
"type":"credentials",
"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);
}

View File

@@ -51,7 +51,7 @@ function serveFile(app,baseUrl,file) {
app.get(url,function(req, res) {
res.sendfile(file);
});
return url;
return "theme"+url;
} catch(err) {
//TODO: log filenotfound
return null;
@@ -79,7 +79,7 @@ module.exports = {
for (i=0;i<styles.length;i++) {
url = serveFile(themeApp,"/css/",styles[i]);
if (url) {
themeContext.page.css.push("theme"+url);
themeContext.page.css.push(url);
}
}
}
@@ -87,7 +87,7 @@ module.exports = {
if (theme.page.favicon) {
url = serveFile(themeApp,"/favicon/",theme.page.favicon)
if (url) {
themeContext.page.favicon = "theme"+url;
themeContext.page.favicon = url;
}
}
@@ -101,7 +101,7 @@ module.exports = {
if (theme.header.image) {
url = serveFile(themeApp,"/header/",theme.header.image);
if (url) {
themeContext.header.image = "theme"+url;
themeContext.header.image = url;
}
} else {
themeContext.header.image = null;
@@ -120,7 +120,7 @@ module.exports = {
if (theme.deployButton.icon) {
url = serveFile(themeApp,"/deploy/",theme.deployButton.icon);
if (url) {
themeSettings.deployButton.icon = "theme"+url;
themeSettings.deployButton.icon = url;
}
}
}
@@ -131,6 +131,16 @@ module.exports = {
}
//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;
}
},