mirror of
https://github.com/OliveTin/OliveTin
synced 2025-12-13 01:25:45 +00:00
feature: Login/Logout links (#443)
* feature: Login/Logout links * cicd: codestyle
This commit is contained in:
@@ -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')
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user