support revoking tokens from token page

This commit is contained in:
Min RK
2018-04-16 11:07:40 +02:00
parent 32fe3cf61d
commit 33cb62c2ee
3 changed files with 20 additions and 3 deletions

View File

@@ -32,5 +32,22 @@ require(["jquery", "jhapi", "moment"], function($, JHAPI, moment) {
);
return false;
});
function get_token_row(element) {
while (!element.hasClass("token-row")) {
element = element.parent();
}
return element;
}
$(".revoke-token-btn").click(function() {
var el = $(this);
var row = get_token_row(el);
el.attr("disabled", true);
api.revoke_token(user, row.data('token-id'), {
success: function(reply) {
row.remove();
},
});
});
});