mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Support custom login message and button
This commit is contained in:
@@ -126,6 +126,14 @@ async function login(req,res) {
|
||||
if (themeContext.login && themeContext.login.image) {
|
||||
response.image = themeContext.login.image;
|
||||
}
|
||||
if (themeContext.login?.message) {
|
||||
response.loginMessage = themeContext.login?.message
|
||||
}
|
||||
if (themeContext.login?.button) {
|
||||
response.prompts = [
|
||||
{ type: "button", ...themeContext.login.button }
|
||||
]
|
||||
}
|
||||
}
|
||||
res.json(response);
|
||||
}
|
||||
|
@@ -206,14 +206,28 @@ module.exports = {
|
||||
}
|
||||
|
||||
if (theme.login) {
|
||||
let themeContextLogin = {}
|
||||
let hasLoginTheme = false
|
||||
if (theme.login.image) {
|
||||
url = serveFile(themeApp,"/login/",theme.login.image);
|
||||
if (url) {
|
||||
themeContext.login = {
|
||||
themeContextLogin.login = {
|
||||
image: url
|
||||
}
|
||||
hasLoginTheme = true
|
||||
}
|
||||
}
|
||||
if (theme.login.message) {
|
||||
themeContextLogin.message = theme.login.message
|
||||
hasLoginTheme = true
|
||||
}
|
||||
if (theme.login.button) {
|
||||
themeContextLogin.button = theme.login.button
|
||||
hasLoginTheme = true
|
||||
}
|
||||
if (hasLoginTheme) {
|
||||
themeContext.login = themeContextLogin
|
||||
}
|
||||
}
|
||||
themeApp.get("/", async function(req,res) {
|
||||
const themePluginList = await runtimeAPI.plugins.getPluginsByType({type:"node-red-theme"});
|
||||
|
Reference in New Issue
Block a user