oauth2: Delete Token Banner

This updates the Delete Token functionality to show a success/error
banner when deleting the token. If successful it will delete the Token
tab and content, load the IdP tab, and show a success banner with the
JSON content. On error it will simply show an error banner with the JSON
content.
This commit is contained in:
JediKev
2023-02-22 16:36:37 -06:00
parent f531718a56
commit c0cd8b16d0

View File

@@ -189,8 +189,17 @@ $(function() {
url: 'ajax.php/' + $(this).attr('href').substr(1),
type: 'POST',
success: function(json) {
$.toggleOverlay(false);
$('#popup').hide();
// Remove the Token tab completely
$('#popup a[href="#token"]').parent().remove();
$('#popup div#token').remove();
// Add success banner
$('#popup form').before('<div id="msg_notice">'+json+'</div>');
// Load the IdP tab
$('#popup a[href="#idp"]').click();
},
error: function(json) {
// Add error banner
$('#popup form').before('<div id="msg_error">'+json.responseText+'</div>');
}
});
}