Skip to content

Commit

Permalink
Merge pull request #332 from FlowFuse/login-message
Browse files Browse the repository at this point in the history
Apply custom message in login dialog on direct access
  • Loading branch information
knolleary authored Dec 18, 2024
2 parents f312b97 + 804c57f commit bf258f3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
16 changes: 9 additions & 7 deletions lib/template/template-settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ let got
let agentApplied

const auth = {
type: 'credentials', // the type of the auth
tokenHeader: 'x-access-token', // the header where node-red expects to find the token
tokens: async function (token) {
const [prefix, deviceId] = (token + '').split('_')
Expand Down Expand Up @@ -94,12 +93,6 @@ const auth = {
} catch (err) {
console.log('error getting new token', err)
}
},
users: async function (username) {
return null
},
authenticate: async function (username, password) {
return null
}
}

Expand Down Expand Up @@ -169,6 +162,15 @@ const runtimeSettings = {
[themeName]: { ...themeSettings },
editorTheme: { ...editorTheme }
}
runtimeSettings.editorTheme.login = {
message: 'Access the editor through the FlowFuse platform'
}
if (themeSettings.projectURL) {
runtimeSettings.editorTheme.login.button = {
url: themeSettings.projectURL,
label: 'Open FlowFuse Dashboard'
}
}

if (settings.flowforge.auditLogger?.bin && settings.flowforge.auditLogger?.url) {
try {
Expand Down
8 changes: 4 additions & 4 deletions test/unit/lib/template-settings_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,7 @@ describe('template-settings', () => {
const settings = require(settingsFile)
should.exist(settings)
settings.should.have.a.property('adminAuth').and.be.an.Object()
settings.adminAuth.should.have.a.property('type', 'credentials')
settings.adminAuth.should.have.a.property('users').and.be.a.Function()
settings.adminAuth.should.have.a.property('authenticate').and.be.a.Function()
settings.adminAuth.should.have.a.property('tokens').and.be.a.Function()
settings.adminAuth.should.not.have.a.property('type')

settings.should.have.a.property('contextStorage').and.be.an.Object()
settings.contextStorage.should.have.a.property('default', 'memory')
Expand All @@ -76,6 +73,9 @@ describe('template-settings', () => {
settings.editorTheme.codeEditor.should.have.a.property('lib', 'monaco')
settings.editorTheme.tours.should.be.false()
settings.editorTheme.should.have.a.property('palette').and.be.an.Object()
settings.editorTheme.should.have.a.property('login').and.be.an.Object()
settings.editorTheme.login.should.have.a.property('message').and.be.an.String()
settings.editorTheme.login.should.have.a.property('button').and.be.an.Object()

settings.should.have.a.property('externalModules').and.be.an.Object()
settings.externalModules.should.have.a.property('autoInstall', true)
Expand Down

0 comments on commit bf258f3

Please sign in to comment.