diff --git a/src/views/tokens.html b/src/views/tokens.html
index fc0cf7375..5a7fcac46 100644
--- a/src/views/tokens.html
+++ b/src/views/tokens.html
@@ -72,7 +72,7 @@
diff --git a/src/views/tokens.js b/src/views/tokens.js
index 439a53b98..324aab4ba 100644
--- a/src/views/tokens.js
+++ b/src/views/tokens.js
@@ -100,29 +100,32 @@ angular.module('Application').controller('TokensController', ['$scope', '$locati
tokenName: '',
busy: false,
error: {},
+ client: null,
reset: function () {
$scope.tokenAdd.busy = false;
$scope.tokenAdd.token = {};
$scope.tokenAdd.error.tokenName = null;
$scope.tokenAdd.tokenName = '';
+ $scope.tokenAdd.client = null;
$scope.tokenAddForm.$setUntouched();
$scope.tokenAddForm.$setPristine();
},
- show: function () {
+ show: function (client) {
$scope.tokenAdd.reset();
+ $scope.tokenAdd.client = client;
$('#tokenAddModal').modal('show');
},
- submit: function (client) {
+ submit: function () {
$scope.tokenAdd.busy = true;
$scope.tokenAdd.token = {};
var expiresAt = Date.now() + 100 * 365 * 24 * 60 * 60 * 1000; // ~100 years from now
- Client.createTokenByClientId(client.id, '*' /* scope */, expiresAt, $scope.tokenAdd.tokenName, function (error, result) {
+ Client.createTokenByClientId($scope.tokenAdd.client.id, '*' /* scope */, expiresAt, $scope.tokenAdd.tokenName, function (error, result) {
if (error) {
if (error.statusCode === 400) {
$scope.tokenAdd.error.tokenName = 'Invalid token name';
@@ -137,7 +140,7 @@ angular.module('Application').controller('TokensController', ['$scope', '$locati
$scope.tokenAdd.busy = false;
$scope.tokenAdd.token = result;
- refreshClientTokens(client);
+ refreshClientTokens($scope.tokenAdd.client);
});
}
};