Commit 44ccbaab authored by Lauri Himanen's avatar Lauri Himanen
Browse files

Now the login panel elements are rendered simultaneously.

parent d7f5502a
Pipeline #79118 skipped with stage
......@@ -13,31 +13,29 @@ var keycloak = new Keycloak({
realm: window.nomadEnv.keycloakRealm,
clientId: window.nomadEnv.keycloakClientId
});
let loginButton = document.querySelector('#login-button');
let logoutButton = document.querySelector('#logout-button');
let userName = document.querySelector('#user-name');
keycloak.init({
onLoad: "check-sso",
silentCheckSsoRedirectUri: "http://localhost:3000/gui/silent-check-sso.html",
promiseType: "native",
}).then((authenticated) => {
let loginButton = document.querySelector('#login-button');
let logoutButton = document.querySelector('#logout-button');
let userName = document.querySelector('#user-name');
if (authenticated) {
keycloak.loadUserProfile()
.then(function(profile) {
userName.textContent = `${profile.firstName} ${profile.lastName}`;
loginButton.style.display = 'none';
logoutButton.style.display = 'inline';
}).catch(function() {
console.log('Failed to load user profile.');
});
loginButton.style.display = 'none';
logoutButton.style.display = 'inline';
} else {
loginButton.style.display = 'inline';
logoutButton.style.display = 'none';
userName.textContent = "Guest";
}
});
let loginButton = document.querySelector('#login-button');
let logoutButton = document.querySelector('#logout-button');
loginButton.onclick = () => {
keycloak.login({redirectUri: "http://" + window.location.host + "/gui/#/search"})
.catch(() => {console.log("Authentication error.")})
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment