From 30cbb2160e0cf0c6f19c908323e23ca50513bed2 Mon Sep 17 00:00:00 2001 From: Marvin Scham Date: Mon, 4 Mar 2024 04:49:27 +0100 Subject: [PATCH] Init --- script.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 script.js diff --git a/script.js b/script.js new file mode 100644 index 0000000..c010012 --- /dev/null +++ b/script.js @@ -0,0 +1,21 @@ +console.log("Keycloak Script running!"); +const keycloak = new Keycloak({ + realm: "schmoekerei", + url: "https://auth.xn--schmkerei-37a.de", + clientId: "heimdall" +}); + +keycloak.init({ onLoad: 'login-required' }).then(function(authenticated) { + if (authenticated) { + console.log("User is authenticated"); + } +}).catch(function() { + console.error("Authenticated Failed"); +}); + +const wrapper = document.querySelector("#config-buttons"); +const kcUserLink = wrapper.querySelector("#users").cloneNode(true); +kcUserLink.href = "https://auth.xn--schmkerei-37a.de/realms/schmoekerei/account"; +kcUserLink.id = "kcUserSettings"; +wrapper.append(kcUserLink); +kcUserLink.querySelector("div").innerHTML = "Account-Einstellungen";