diff --git a/src/views/profile.html b/src/views/profile.html
index 55deeb5f8..ead8b01b5 100644
--- a/src/views/profile.html
+++ b/src/views/profile.html
@@ -356,7 +356,7 @@
{{ password.prettyIdentifier }}
-
+
|
@@ -366,6 +366,8 @@
+
+
Login and API Tokens
@@ -393,12 +395,12 @@
{{ token.clientId }}
-
+
|
-
+
diff --git a/src/views/profile.js b/src/views/profile.js
index e480b26f2..295b89495 100644
--- a/src/views/profile.js
+++ b/src/views/profile.js
@@ -512,7 +512,18 @@ angular.module('Application').controller('ProfileController', ['$scope', '$locat
},
revokeAll: function () {
+ $scope.tokens.busy = true;
+ asyncForEach($scope.tokens.webadminTokens.concat($scope.tokens.cliTokens), function (token, callback) {
+ // do not revoke token for this session, will do at the end with logout
+ if (token.accessToken === Client.getToken()) return callback();
+
+ Client.delToken(token.id, callback);
+ }, function (error) {
+ if (error) console.error(error);
+
+ Client.logout();
+ });
},
add: {
@@ -527,6 +538,14 @@ angular.module('Application').controller('ProfileController', ['$scope', '$locat
submit: function () {
}
+ },
+
+ revokeToken: function (token) {
+ Client.delToken(token.id, function (error) {
+ if (error) console.error(error);
+
+ $scope.tokens.refresh();
+ });
}
};