From e315a3061e9eaad7720d091ef8fbbb330b4c98e0 Mon Sep 17 00:00:00 2001 From: STEINNI Date: Wed, 3 Sep 2025 22:39:04 +0000 Subject: [PATCH] checkauth logic & login dialog --- app/assets/styles/intro.css | 48 +++++++++++++++++++++++++++--- app/config/config.json | 11 ++----- app/libs/myUser.js | 41 +++++++++++++++---------- app/thirdparty/eicui/eicui-2.0.css | 1 + index.html | 13 +++++++- 5 files changed, 86 insertions(+), 28 deletions(-) diff --git a/app/assets/styles/intro.css b/app/assets/styles/intro.css index 1318a6b..4ffd3f9 100644 --- a/app/assets/styles/intro.css +++ b/app/assets/styles/intro.css @@ -6,6 +6,7 @@ body { min-height: 100vh; background: #000; overflow: hidden; + font-family: sans; } .glowing { @@ -117,7 +118,6 @@ body { will-change: filter, opacity; color: #FFF; position: absolute; - font-family: sans; text-shadow: 3px -3px 5px #C5F7FF; } @@ -135,14 +135,54 @@ body { #startbtn{ cursor: default; position: absolute; - bottom: 25%; + bottom: 15vh; color: aliceblue; - font-family: sans; font-style: italic; font-size: 40px; border-radius: 100px; padding: 5px 40px; - background: radial-gradient(#282362, #0a8200); + background: radial-gradient(#82cc50, #0a8200); box-shadow: 2px 2px 10px #BAFFEF, -2px -2px 10px #BAFFEF, -2px 0 10px #BAFFEF, 0 -2px 10px #BAFFEF; animation: startbtnanim 5s ease-out forwards; +} + +#startbtn[disabled]{ + filter: brightness(.3); +} + +#login-dialog{ + width: 22rem; + z-index: 99; + border-radius: 2rem; + box-shadow: 2px 2px 10px #BAFFEF, -2px -2px 10px #BAFFEF, -2px 0 10px #BAFFEF, 0 -2px 10px #BAFFEF; + background: radial-gradient(#82cc50, #0a8200); + padding: 2rem 3rem 0 3rem; + margin-top: -68vh; + opacity: 0; + visibility: hidden; + transition: opacity 0.5s ease; + font-size: 1.3rem; +} +#login-dialog.show { + opacity: 1; + visibility: visible; +} +#login-dialog > div{ + display: grid !important; + grid-gap: 10px; + grid-template-columns: 7rem 15rem; +} +#login-dialog > div{ + margin-bottom: 1rem; +} +#login-dialog input{ + line-height: 2rem; + width: 15rem; + border-radius: 5px; + border: none; + font-size: 1.3rem; +} +#login-dialog button{ + justify-self: end; + font-size: 1.3rem; } \ No newline at end of file diff --git a/app/config/config.json b/app/config/config.json index 0d5af90..89d6a77 100644 --- a/app/config/config.json +++ b/app/config/config.json @@ -30,14 +30,9 @@ }, "userLib": { "className": "myUser", - "authEndpoint": "https://api.dev.eismea.eu/stable/authorizer/checkAuthenticated", - "logoutEndpoint": "https://api.dev.eismea.eu/stable/authorizer/logout", - "apiDiscoveryEndpoint": "https://api.dev.eismea.eu/stable/apis/services", - "resourcePermissionsEndpoint": "https://api.dev.eismea.eu/stable/permissions", - "apiStage": "stable", - "apiStageExceptions": { - }, - "authForwardDomain": true, + "checkauthEndpoint": "/api/checkauth", + "loginEndpoint": "/api/logout", + "logoutEndpoint": "/api/logout", "keepAliveSeconds": 0 }, "matomo4sparc": { diff --git a/app/libs/myUser.js b/app/libs/myUser.js index b100125..cbb1ab8 100755 --- a/app/libs/myUser.js +++ b/app/libs/myUser.js @@ -89,23 +89,34 @@ class myUser extends app.LoadedClasses.User { * * @param {*} callBack */ - checkAuthenticated(callBack){ - let headers = {}; - if(app.config.userLib.authForwardDomain) { - let url = new URL(document.location.href); - headers = { 'x-requested-path': url.pathname }; - } + async checkAuthenticated(callBack){ + + document.getElementById('startbtn').addEventListener('click', async () => { + document.getElementById('startbtn').disabled = true + const response = await fetch(app.config.userLib.checkauthEndpoint+'?'+crypto.randomUUID()) + let payload = null + if(response.ok) { payload = await response.json() } + if(!payload) { + console.error('No valid response from checkauth !?') + document.getElementById('startbtn').disabled = false + } else if(!payload.authenticated){ + console.log('==>login',app) + document.getElementById('login-dialog').classList.add('show') + } else { + console.log('authenticated!') + } - document.getElementById('startbtn').addEventListener('click', () => { - console.log('====> click') - callBack() }) - this.identity = { - uuid: 'nike', - email: 'info@nicsys.eu' - }; - this.roles = ['admin'] - this.isAuthenticated = true + // console.log('====> click') + // callBack() + // }) + // this.identity = { + // uuid: 'nike', + // email: 'info@nicsys.eu' + // }; + // this.roles = ['admin'] + // this.isAuthenticated = true + //setTimeout(callBack, 20000); /* diff --git a/app/thirdparty/eicui/eicui-2.0.css b/app/thirdparty/eicui/eicui-2.0.css index 873b11f..5056fc2 100755 --- a/app/thirdparty/eicui/eicui-2.0.css +++ b/app/thirdparty/eicui/eicui-2.0.css @@ -547,6 +547,7 @@ animation: spin 1.5s linear infinite; } + body[eicapp] { --eicui-body-bg-color: var(--eicui-app-body-bg-color); --eicui-body-color: var(--eicui-base-color); diff --git a/index.html b/index.html index 47ab791..51970c7 100644 --- a/index.html +++ b/index.html @@ -25,6 +25,17 @@ -
START
+ +
+
+ + +
+
+ + +
+
+
\ No newline at end of file