feature: Login/Logout links (#443)

* feature: Login/Logout links

* cicd: codestyle
This commit is contained in:
James Read
2024-10-19 08:49:41 +01:00
committed by GitHub
parent 1af2e92132
commit 0283b51eca
12 changed files with 180 additions and 63 deletions

View File

@@ -70,6 +70,21 @@ export function marshalDashboardComponentsJsonToHtml (json) {
document.getElementById('username').innerText = json.authenticatedUser
if (window.settings.AuthLocalLogin || window.settings.AuthLocalRegister != null) {
if (json.authenticatedUser === 'guest') {
document.getElementById('link-login').hidden = false
document.getElementById('link-logout').hidden = true
} else {
document.getElementById('link-login').hidden = true
if (json.authenticatedUserProvider === 'local' || json.authenticatedUserProvider === 'oauth2') {
document.getElementById('link-logout').hidden = false
}
}
document.getElementById('username').setAttribute('title', json.authenticatedUserProvider)
}
document.body.setAttribute('initial-marshal-complete', 'true')
}