Added garbage collection for expired and defunct tokens in database.
This commit is contained in:
		| @@ -2,14 +2,43 @@ $(document).ready(function(){ | ||||
|     // Initialize the editable-table functionality | ||||
|     $('#usertable').editableTableWidget(); | ||||
|  | ||||
|     // Prevent clicking *through* popup-screens | ||||
|     $('#sessions').click(function(event) { | ||||
|         event.stopPropagation(); | ||||
|     }); | ||||
|      | ||||
|     // Add eventhandlers to buttons | ||||
|     $('#usertable button.session').click(function() { | ||||
|         event.stopPropagation(); | ||||
|         $('#sessions tbody').empty(); | ||||
|         $('#sessions').fadeToggle(); | ||||
|  | ||||
|         $.post("lucidAuth.manage.php", { | ||||
| 			do: "retrievesessions", | ||||
| 			userid: $(this).closest('tr').find('td:nth-child(1)').data('userid') | ||||
| 		}) | ||||
| 		.done(function(data,_status) { | ||||
| 			if (data.Result === 'Success') { | ||||
|                 var Sessions = JSON.parse(data.UserSessions); | ||||
|                 for (var i = 0; i < data.SessionCount; i++) { | ||||
|                     try { | ||||
|                         var Fingerprint = JSON.parse(atob(Sessions[i]['fp'])); | ||||
|                     } catch(e) { | ||||
|                         // Do nothing | ||||
|                     }  | ||||
|                     $('#sessiontable tbody').append($('<tr>') | ||||
|                         .append($('<td>', { | ||||
|                             text: new Date(Sessions[i]['iat'] * 1000).toLocaleString('en-GB') | ||||
|                         })) | ||||
|                         .append($('<td>', { | ||||
|                             text: Sessions[i]['iss'] | ||||
|                         })) | ||||
|                         .append($('<td>', { | ||||
| //                            text: Sessions[i]['fp'] ? atob(Sessions[i]['fp'])['browser'] + '(' + atob(Sessions[i]['fp'])['platform'] + ')' : '' | ||||
|                             text: Fingerprint ? Fingerprint['browser'] + ' (' + Fingerprint['platform'] + ')' : '' | ||||
|                         })) | ||||
|                     ); | ||||
|                 } | ||||
| 			} else { | ||||
| 			} | ||||
| 		}); | ||||
| @@ -107,4 +136,8 @@ console.log({'new': newEntries, 'removed': removedEntries}); | ||||
| 		} | ||||
| 	}); | ||||
|  | ||||
| }); | ||||
|  | ||||
| $(document).click(function () { | ||||
|     $('#sessions').fadeOut(); | ||||
| }); | ||||
| @@ -7,7 +7,8 @@ var locales = { | ||||
| 		button_delete:				"delete", | ||||
| 		button_login:				"login", | ||||
| 		heading_error:				"ERROR!", | ||||
| 		label_password:				"Password:", | ||||
|         label_password:				"Password:", | ||||
|         label_sessions:				"Sessions", | ||||
| 		label_username:				"Username:", | ||||
| 		link_logout:				"Logout", | ||||
| 		span_credentialsavailable:	"Login credentials available upon request!", | ||||
| @@ -24,7 +25,8 @@ var locales = { | ||||
| 		button_delete:				"verwijder", | ||||
| 		button_login:				"log in", | ||||
| 		heading_error:				"FOUT!", | ||||
| 		label_password:				"Wachtwoord:", | ||||
|         label_password:				"Wachtwoord:", | ||||
|         label_sessions:				"Sessies", | ||||
| 		label_username:				"Gebruikersnaam:", | ||||
| 		link_logout:				"Log uit", | ||||
| 		span_credentialsavailable:	"Inloggegevens verkrijgbaar op aanvraag!", | ||||
|   | ||||
| @@ -129,6 +129,23 @@ body { | ||||
|             .main section .buttons button { | ||||
|                 margin-left: inherit; | ||||
|             } | ||||
|         .main section #sessions { | ||||
| 			display: none; | ||||
| 			position: absolute; | ||||
| 			top: calc(50% - 160px); | ||||
| 			right: 20%; | ||||
| 			height: 320px; | ||||
| 			width: 60%; | ||||
| 			border: 1px solid rgb(0, 51, 153); | ||||
| 			box-shadow: black 0px 0px 20px; | ||||
| 			box-sizing: border-box; | ||||
| 	    	padding-top: 5px; | ||||
| 			background: white; | ||||
| 	    	font-size: inherit; | ||||
| 	    	font-weight: bold; | ||||
|             z-index: 99; | ||||
|             overflow-y: auto; | ||||
|         } | ||||
|         .main section table { | ||||
|             width: 100%; | ||||
|         } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user