From 190d8df3349cec0a1e74874c2c35583a12d43f46 Mon Sep 17 00:00:00 2001 From: STEINNI Date: Thu, 11 Sep 2025 20:40:32 +0000 Subject: [PATCH] login & anim ok --- app/assets/styles/intro.css | 52 ++++++---- app/config/config.json | 15 +-- app/controllers/EICAppController.js | 2 - app/controllers/EICAppController.json | 1 - app/libs/myUser.js | 136 +++++++++++++------------- index.html | 23 ++--- index_old.html | 124 ----------------------- 7 files changed, 114 insertions(+), 239 deletions(-) delete mode 100644 index_old.html diff --git a/app/assets/styles/intro.css b/app/assets/styles/intro.css index 4ffd3f9..87a2f42 100644 --- a/app/assets/styles/intro.css +++ b/app/assets/styles/intro.css @@ -16,7 +16,7 @@ body { transform-origin: right; animation: colorChange 5s linear infinite; animation: fadeaway 30s forwards; - left: calc(50% + var(--j) * 50%); + left: calc(50%); transform: translateX(-50%); } @@ -25,14 +25,8 @@ body { } @keyframes colorChange { - 0% { - filter: hue-rotate(0deg); - transform: rotate(0deg); - } - 100% { - filter: hue-rotate(360deg); - transform: rotate(360deg); - } + 0% { filter: hue-rotate(0deg); } + 100% { filter: hue-rotate(360deg); } } .glowing span { @@ -83,7 +77,7 @@ body { } .glowing span:nth-child(3n + 1) { - animation: rotatedots 15s alternate infinite; + animation: rotatedots1 15s alternate infinite; } .glowing span:nth-child(3n + 2) { @@ -91,7 +85,7 @@ body { } .glowing span:nth-child(3n + 3) { - animation: rotatedots 11s alternate infinite; + animation: rotatedots1 11s alternate infinite; } @keyframes fadeaway { @@ -100,16 +94,17 @@ body { 100% { opacity: 0; } } -@keyframes rotatedots { - 0% { transform: rotate(180deg); } - 50% { transform: rotate(0deg); } - 100% { transform: rotate(360deg); } +@keyframes rotatedots1 { + 0% { transform: rotate(calc(180deg * var(--i))); } + 50% { transform: rotate(calc(0deg * var(--i))); } + 100% { transform: rotate(calc(360deg * var(--i))); } } + @keyframes rotatedots-reverse { - 0% { transform: rotate(360deg); } - 50% { transform: rotate(180deg); } - 100% { transform: rotate(0deg); } + 0% { transform: rotate(calc(135deg * var(--i))); } + 50% { transform: rotate(calc(-45deg * var(--i))); } + 100% { transform: rotate(calc(315deg * var(--i))); } } .logointro{ filter: blur(14px); @@ -153,21 +148,23 @@ body { #login-dialog{ width: 22rem; z-index: 99; - border-radius: 2rem; + border-radius: 1rem; 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; + padding: 2rem 3rem 1rem 3rem; margin-top: -68vh; opacity: 0; visibility: hidden; transition: opacity 0.5s ease; font-size: 1.3rem; + transform: perspective(200px) rotateY(0deg) rotateX(6deg) rotateZ(0deg); + transform-style: preserve-3d; } #login-dialog.show { opacity: 1; visibility: visible; } -#login-dialog > div{ +#login-dialog > div.cols2{ display: grid !important; grid-gap: 10px; grid-template-columns: 7rem 15rem; @@ -185,4 +182,17 @@ body { #login-dialog button{ justify-self: end; font-size: 1.3rem; + float: right; +} +#login-dialog div.loginerr{ + background-color: #326A1E; + font-size: 1rem; + color: #FFF; + padding: .1rem .5rem; + border-radius: 5px; + text-align: center; + display:none; +} +#login-dialog div.loginerr.show{ + display:block!important; } \ No newline at end of file diff --git a/app/config/config.json b/app/config/config.json index 89d6a77..8c3beb1 100644 --- a/app/config/config.json +++ b/app/config/config.json @@ -12,12 +12,7 @@ "path": "/EIC", "classes": [ "EICController", "EICDomContent", "EICDialogContent", "EICMetaData", "EICModel", "EICPluralModel", "EICBusModel" ], "dependencies" : { "EICPluralModel": [ "EICModel" ] } - }, - { "onlyIfClasses": [ "MessageBus" ], - "path": "/Bus/rendezVous", - "classes": [ "MBRendezVous" ], - "dependencies" : { } - } + } ], "masterController": "EICAppController", "defaultMasterTemplate": "templates/EICAppTemplate" @@ -31,15 +26,10 @@ "userLib": { "className": "myUser", "checkauthEndpoint": "/api/checkauth", - "loginEndpoint": "/api/logout", + "loginEndpoint": "/api/login", "logoutEndpoint": "/api/logout", "keepAliveSeconds": 0 }, - "matomo4sparc": { - "enabled": true, - "trackUrl": "https://analytics.test.eismea.eu/matomo.php", - "idsite":7 - }, "messageBus":{ "enabled": true, "debug": true, @@ -59,7 +49,6 @@ "autoReconnectJitterPercent": 10, "frontBusPrefix": "", "userNotifChan": "system:notifs:{uid}", - "rendezVousChan": "rendezVous:{uid}", "ptpChanPrefix": "peer2peer:" }, "squeeze": { diff --git a/app/controllers/EICAppController.js b/app/controllers/EICAppController.js index 97b5abc..7870da2 100755 --- a/app/controllers/EICAppController.js +++ b/app/controllers/EICAppController.js @@ -8,8 +8,6 @@ class EICAppController extends MasterController { } onBusConnected() { - //if('MBRendezVous' in app.LoadedClasses) app.MessageBus.rendezVous = new MBRendezVous(this) - app.MessageBus.addBusListener( 'growl', ['system:notifs', diff --git a/app/controllers/EICAppController.json b/app/controllers/EICAppController.json index 5fb24c0..d370fa3 100755 --- a/app/controllers/EICAppController.json +++ b/app/controllers/EICAppController.json @@ -3,7 +3,6 @@ "views": [ "templates/EICAppTemplate", "templates/dialogs/ConfirmDialog" ], "controllerDependencies": [ "/thirdparty/eicui/eicui-2.1", - "/thirdparty/Matomo/Matomo4Sparc", "/controllers/common/errorController" ], "assets": { diff --git a/app/libs/myUser.js b/app/libs/myUser.js index cbb1ab8..a6f00ef 100755 --- a/app/libs/myUser.js +++ b/app/libs/myUser.js @@ -90,81 +90,46 @@ class myUser extends app.LoadedClasses.User { * @param {*} callBack */ async checkAuthenticated(callBack){ + const startbtn = document.querySelector('#startbtn') + const gobtn = document.querySelector('#login-dialog button') - document.getElementById('startbtn').addEventListener('click', async () => { - document.getElementById('startbtn').disabled = true + gobtn.addEventListener('click', async () => { + gobtn.disabled = true + if(await this.login()) { + document.querySelector('div.loginerr').classList.remove('show') + console.log('Successful login !!!') + callBack() + } else { + gobtn.disabled = false + } + }) + + startbtn.addEventListener('click', async () => { + startbtn.disabled = true + this.isAuthenticated = false const response = await fetch(app.config.userLib.checkauthEndpoint+'?'+crypto.randomUUID()) - let payload = null - if(response.ok) { payload = await response.json() } - if(!payload) { + let jsonresp = null + if(response.ok) { jsonresp = await response.json() } + if(!jsonresp ||(!jsonresp.payload)) { console.error('No valid response from checkauth !?') - document.getElementById('startbtn').disabled = false - } else if(!payload.authenticated){ - console.log('==>login',app) + startbtn.disabled = false + } else if(!jsonresp.payload.authenticated){ + document.querySelector('div.loginerr').classList.remove('show') document.getElementById('login-dialog').classList.add('show') + if(jsonresp.payload.locked){ + document.querySelector('div.loginerr').classList.add('show') + document.querySelector('div.loginerr').innerHTML = ` + The account has been locked !
+ (Ask an admin to unlock it.) + ` + } } else { console.log('authenticated!') + this.isAuthenticated = true + callBack() } - }) - // console.log('====> click') - // callBack() - // }) - // this.identity = { - // uuid: 'nike', - // email: 'info@nicsys.eu' - // }; - // this.roles = ['admin'] - // this.isAuthenticated = true - - //setTimeout(callBack, 20000); - /* - - fetch(app.config.userLib.authEndpoint+'?'+crypto.randomUUID(),{ - headers: headers, - method: 'GET', - credentials: 'include' - }) - .then(response => response.json()) - .then(async resp => { - if(resp.success){ - this.authenticationDone = true - this.isAuthenticated = resp.payload.isAuthenticated; - if(resp.payload.isAuthenticated) { - if((!this.identity) || (!this.identity.uuid)) { - this.logoutUrl = resp.payload.logoutUri; - this.parseUserInfo(resp.payload.userInfo); - } - - this.platformRestrictions = resp.payload.platformRestrictions || null - if((this.platformRestrictions) && (!this.isVIP())){ - this.ShowCurtain() - this.stopKeepAlive() - return // not triggering callback avoids any further ctrl loading by the router - } - - if(!app.config.api) await this.getApiServices() - - if(app.config.userLib.keepAliveSeconds && (app.config.userLib.keepAliveSeconds>0)) this.startKeepAlive() - - callBack(); - } else { - console.warn('Authorizer said User was not authenticated !'); - this.authUrl = resp.payload.authUrl; - this.logoutUrl = resp.payload.logoutUri; - callBack(); - } - } else { - console.error('Server error calling authorizer checkAuthenticated (success not true)'); - this.stopKeepAlive() // Just in case KAL is active, because we arrive here from KAL itself - document.location.href = '/eulogin-error.html'; - } - }) - .catch((err) => { - console.error('Server error calling authorizer checkAuthenticated (Network error)',err); - document.location.href = '/eulogin-error.html'; - }); - */ + }) } /** @@ -173,6 +138,43 @@ class myUser extends app.LoadedClasses.User { */ getMessageBusUserInfo() { return(this.identity.uuid) } + async login(){ + const response = await fetch(app.config.userLib.loginEndpoint+'?'+crypto.randomUUID(), { + method: 'POST', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify({ + username: document.querySelector('input[name="username"]').value, + passwd: document.querySelector('input[name="password"]').value, + }) + }) + let jsonresp = null + if(response.ok) { jsonresp = await response.json() } + if(jsonresp && jsonresp.success && jsonresp.payload){ + if(jsonresp.payload.authenticated){ + this.isAuthenticated = true + this.userInfos = jsonresp.payload.userInfos + return(true) + } else { + document.querySelector('div.loginerr').classList.add('show') + if(!jsonresp.payload.locked){ + document.querySelector('div.loginerr').innerHTML = ` + Bad username or password !
+ (${jsonresp.payload.trials} trials left.) + ` + } else { + document.querySelector('div.loginerr').innerHTML = ` + The account has been locked !
+ (Ask an admin to unlock it.) + ` + } + } + } + this.isAuthenticated = false + this.userInfos = null + return(false) + } /** * diff --git a/index.html b/index.html index 51970c7..f91cb4d 100644 --- a/index.html +++ b/index.html @@ -9,33 +9,34 @@ -
+
-
- - - +
+ + +
-
- - +
+ +
-
+
-
+
-
+
+
\ No newline at end of file diff --git a/index_old.html b/index_old.html deleted file mode 100644 index e5ee3f9..0000000 --- a/index_old.html +++ /dev/null @@ -1,124 +0,0 @@ - - - - - European Innovation Council - - - - -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -
-

Server error

-
-
-
- - Unfortunately, the server cannot authenticate you at the moment,
- Please try again later. -
-
-
-
-
- -