checkauth logic & login dialog
This commit is contained in:
@@ -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;
|
||||
}
|
||||
@@ -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
@@ -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);
|
||||
/*
|
||||
|
||||
|
||||
Vendored
+1
@@ -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);
|
||||
|
||||
+12
-1
@@ -25,6 +25,17 @@
|
||||
<span style="--i:3;"></span>
|
||||
</div>
|
||||
<img src="/app/assets/images/logop42-intro.png" class="logointro"/>
|
||||
<div id="startbtn">START</div>
|
||||
<button id="startbtn">START</button>
|
||||
<div id="login-dialog">
|
||||
<div>
|
||||
<label>Username:</label>
|
||||
<input type="text" name="username"/>
|
||||
</div>
|
||||
<div>
|
||||
<label>Password:</label>
|
||||
<input type="password" name="password"/>
|
||||
</div>
|
||||
<div><span></span><button>GO</button></div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user