add ui for token generation

This commit is contained in:
Johannes Zellner
2016-06-07 14:19:20 +02:00
parent d62d2b17fe
commit 6261231593
3 changed files with 46 additions and 1 deletions

View File

@@ -163,6 +163,23 @@
</div>
</div>
<!-- Modal add token -->
<div class="modal fade" id="tokenAddModal" tabindex="-1" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">New token created</h4>
</div>
<div class="modal-body">
<b ng-click-select>{{ tokenAdd.token.accessToken }}</b>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Done</button>
</div>
</div>
</div>
</div>
<br/>
<div class="section-header">
@@ -242,7 +259,7 @@
<hr/>
<h4 class="text-muted">Your Tokens</h4>
<h4 class="text-muted">Your Tokens <button class="btn btn-xs btn-primary btn-outline pull-right" ng-click="tokenAdd.show()"><i class="fa fa-plus"></i> New Token</button></h4>
<p ng-repeat="token in client.activeTokens">
<b ng-click-select>{{ token.accessToken }}</b> <button class="btn btn-xs btn-danger pull-right" ng-click="" title="Revoke Token"><i class="fa fa-trash-o"></i></button>
</p>

View File

@@ -231,6 +231,27 @@ angular.module('Application').controller('AccountController', ['$scope', '$locat
}
};
$scope.tokenAdd = {
busy: false,
token: {},
show: function (client) {
$scope.tokenAdd.busy = true;
$scope.tokenAdd.token = {};
Client.createTokenByClientId(client.id, function (error, result) {
if (error) console.error(error);
$scope.tokenAdd.busy = false;
$scope.tokenAdd.token = result;
$('#tokenAddModal').modal('show');
// refresh token list
});
}
};
$scope.removeAccessTokens = function (client) {
client.busy = true;