checkauth logic & login dialog

This commit is contained in:
STEINNI
2025-09-03 22:39:04 +00:00
parent 3fc9b0731e
commit e315a3061e
5 changed files with 86 additions and 28 deletions
+44 -4
View File
@@ -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;
}
+3 -8
View File
@@ -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": {
+26 -15
View File
@@ -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);
/*
+1
View File
@@ -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);