Added UI elements for managing sessions

This commit is contained in:
2019-12-30 11:44:35 +00:00
parent f14f3866e6
commit f7760ab568
5 changed files with 74 additions and 2 deletions

View File

@ -23,6 +23,7 @@
try {
$JWTPayload = JWT::decode($row['Value'], base64_decode($settings->JWT['PrivateKey_base64']), $settings->JWT['Algorithm']);
$storedTokens[] = [
'tid' => $row['Id'],
'iat' => $JWTPayload->iat,
'iss' => $JWTPayload->iss,
'fp' => $JWTPayload->fp

View File

@ -1,3 +1,25 @@
jQuery.fn.inlineConfirm = function() {
return this.on('click', function(event) {
sessionID = $(this).data('sessionid');
// event.preventDefault();
$(this).off('click').parent().empty().append(
$('<button>', {
text: locales[(localStorage.getItem('language') !== null ? localStorage.getItem('language') : 'en')]['button_yes'],
class: 'bttn-simple bttn-xs bttn-primary sessiondeleteconfirm',
style: 'margin-right: 3px;',
'data-translation': 'button_yes',
'data-sessionid': sessionID
})).append(
$('<button>', {
text: locales[(localStorage.getItem('language') !== null ? localStorage.getItem('language') : 'en')]['button_no'],
class: 'bttn-simple bttn-xs bttn-primary sessiondeletecancel',
'data-translation': 'button_no',
'data-sessionid': sessionID
})
);
});
};
$(document).ready(function(){
// Initialize the editable-table functionality
$('#usertable').editableTableWidget();
@ -39,8 +61,16 @@ $(document).ready(function(){
.append($('<td>', {
html: sessionDetails ? sessionDetails : ''
}))
.append($('<td>', {
html: $('<button>', {
text: locales[(localStorage.getItem('language') !== null ? localStorage.getItem('language') : 'en')]['button_delete'],
class: 'bttn-simple bttn-xs bttn-primary sessiondelete',
'data-translation': 'button_delete',
'data-sessionid': Sessions[i]['tid']})
}))
);
}
$('#sessiontable .sessiondelete').inlineConfirm();
} else {
}
});

View File

@ -5,7 +5,9 @@ var locales = {
button_cancel: "cancel",
button_sessions: "sessions",
button_delete: "delete",
button_login: "login",
button_yes: "yes",
button_no: "no",
button_login: "login",
heading_error: "ERROR!",
label_password: "Password:",
label_sessions: "Sessions",
@ -23,6 +25,8 @@ var locales = {
button_cancel: "annuleren",
button_sessions: "sessies",
button_delete: "verwijder",
button_yes: "ja",
button_no: "nee",
button_login: "log in",
heading_error: "FOUT!",
label_password: "Wachtwoord:",

View File

@ -152,6 +152,12 @@ body {
border: none;
filter: drop-shadow(0px 0px 1px #000);
}
.main section #sessions .sessiondeleteconfirm {
background: crimson linear-gradient(0deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0) 50%, rgba(255,255,255,0.33) 51%) no-repeat center;
}
.main section #sessions .sessiondeletecancel {
background: green linear-gradient(0deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0) 50%, rgba(255,255,255,0.25) 51%) no-repeat center;
}
.main section table {
width: 100%;
}