login & anim ok

This commit is contained in:
STEINNI
2025-09-11 20:40:32 +00:00
parent e315a3061e
commit 190d8df334
7 changed files with 114 additions and 239 deletions
+31 -21
View File
@@ -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;
}
+2 -13
View File
@@ -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": {
-2
View File
@@ -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',
-1
View File
@@ -3,7 +3,6 @@
"views": [ "templates/EICAppTemplate", "templates/dialogs/ConfirmDialog" ],
"controllerDependencies": [
"/thirdparty/eicui/eicui-2.1",
"/thirdparty/Matomo/Matomo4Sparc",
"/controllers/common/errorController"
],
"assets": {
+69 -67
View File
@@ -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 !<br>
(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 !<br>
(${jsonresp.payload.trials} trials left.)
`
} else {
document.querySelector('div.loginerr').innerHTML = `
The account has been locked !<br>
(Ask an admin to unlock it.)
`
}
}
}
this.isAuthenticated = false
this.userInfos = null
return(false)
}
/**
*