implemented user logout

This commit is contained in:
2024-07-22 11:35:37 +02:00
parent 3c4116453b
commit 59b9976dbf
10 changed files with 73 additions and 24 deletions

View File

@@ -4,6 +4,7 @@
<title>Light OIDC</title>
<script src="common.js"></script>
<script src="login.js"></script>
<link rel="stylesheet" href="style.css" />
</head>
<body>
<h1>Login</h1>
@@ -15,7 +16,7 @@
</label>
<label>
Password
<input type="password" id="password" />
<input type="password" id="password" onkeydown="keyDown()"/>
</label>
<button type="button" onClick="tryLogin()">Login</button>
</fieldset>

View File

@@ -30,4 +30,8 @@ function tryLogin(){
})
}).then(handleLogin);
return false;
}
function keyDown(ev){
if (event.keyCode == 13) tryLogin();
}

View File

@@ -0,0 +1,12 @@
<html>
<head>
<meta charset="utf-8">
<title>Light OIDC</title>
<script src="common.js"></script>
<script src="logout.js"></script>
<link rel="stylesheet" href="style.css" />
</head>
<body>
You are being logged out…
</body>
</html>

View File

@@ -0,0 +1,7 @@
function handleLogout(response){
if (response.ok){
document.body.innerHTML += 'success';
document.location.href='index.html';
}
}
fetch(api+"/logout").then(handleLogout)

View File

@@ -4,6 +4,7 @@
<title>Light OIDC</title>
<script src="common.js"></script>
<script src="user.js"></script>
<link rel="stylesheet" href="style.css" />
</head>
<body>
<h1>Add new client</h1>

View File

@@ -38,15 +38,15 @@
<table>
<tr>
<th>Old password</th>
<td><input id="oldpass1" type="password"></td>
</tr>
<tr>
<th>Repeat Password</th>
<td><input id="oldpass2" type="password"></td>
<td><input id="oldpass" type="password"></td>
</tr>
<tr>
<th>New Password</th>
<td><input id="newpass" type="password"></td>
<td><input id="newpass1" type="password"></td>
</tr>
<tr>
<th>Repeat Password</th>
<td><input id="newpass2" type="password" onkeydown="passKeyDown()"></td>
</tr>
</table>
<button id="passBtn" type="button" onClick="updatePass()">Update</button>

View File

@@ -47,8 +47,8 @@ function updatePass(){
disable('passBtn');
setText('passBtn','sent…');
var newData = {
oldpass : [getValue('oldpass1'),getValue('oldpass2')],
newpass : getValue('newpass'),
oldpass : getValue('oldpass'),
newpass : [getValue('newpass1'),getValue('newpass2')],
uuid : getValue('uuid')
}
fetch(api+'/update/password',{
@@ -65,4 +65,8 @@ function updatePass(){
},10000);
}
function passKeyDown(ev){
if (event.keyCode == 13) updatePass();
}
setTimeout(fillForm,100);