Skip to content

Commit bf258f3

Browse files
authored
Merge pull request #332 from FlowFuse/login-message
Apply custom message in login dialog on direct access
2 parents f312b97 + 804c57f commit bf258f3

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

lib/template/template-settings.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ let got
4242
let agentApplied
4343

4444
const auth = {
45-
type: 'credentials', // the type of the auth
4645
tokenHeader: 'x-access-token', // the header where node-red expects to find the token
4746
tokens: async function (token) {
4847
const [prefix, deviceId] = (token + '').split('_')
@@ -94,12 +93,6 @@ const auth = {
9493
} catch (err) {
9594
console.log('error getting new token', err)
9695
}
97-
},
98-
users: async function (username) {
99-
return null
100-
},
101-
authenticate: async function (username, password) {
102-
return null
10396
}
10497
}
10598

@@ -169,6 +162,15 @@ const runtimeSettings = {
169162
[themeName]: { ...themeSettings },
170163
editorTheme: { ...editorTheme }
171164
}
165+
runtimeSettings.editorTheme.login = {
166+
message: 'Access the editor through the FlowFuse platform'
167+
}
168+
if (themeSettings.projectURL) {
169+
runtimeSettings.editorTheme.login.button = {
170+
url: themeSettings.projectURL,
171+
label: 'Open FlowFuse Dashboard'
172+
}
173+
}
172174

173175
if (settings.flowforge.auditLogger?.bin && settings.flowforge.auditLogger?.url) {
174176
try {

test/unit/lib/template-settings_spec.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,7 @@ describe('template-settings', () => {
5555
const settings = require(settingsFile)
5656
should.exist(settings)
5757
settings.should.have.a.property('adminAuth').and.be.an.Object()
58-
settings.adminAuth.should.have.a.property('type', 'credentials')
59-
settings.adminAuth.should.have.a.property('users').and.be.a.Function()
60-
settings.adminAuth.should.have.a.property('authenticate').and.be.a.Function()
61-
settings.adminAuth.should.have.a.property('tokens').and.be.a.Function()
58+
settings.adminAuth.should.not.have.a.property('type')
6259

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

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

0 commit comments

Comments
 (0)