oidc: allow to edit client configs

This commit is contained in:
Johannes Zellner
2023-03-21 19:09:44 +01:00
parent 14bcfbeeb2
commit 3503ab9bb7
3 changed files with 84 additions and 8 deletions
+44 -3
View File
@@ -64,14 +64,55 @@ angular.module('Application').controller('OidcController', ['$scope', '$location
}
};
$scope.clientEdit = {
busy: false,
error: {},
id: '',
secret: '',
loginRedirectUri: '',
logoutRedirectUri: '',
show: function (client) {
$scope.clientEdit.id = client.id;
$scope.clientEdit.secret = client.secret;
$scope.clientEdit.loginRedirectUri = client.loginRedirectUri;
$scope.clientEdit.logoutRedirectUri = client.logoutRedirectUri;
$scope.clientEdit.busy = false;
$scope.clientEdit.error = null;
$scope.clientEditForm.$setPristine();
$('#clientEditModal').modal('show');
},
submit: function () {
$scope.clientEdit.busy = true;
$scope.clientEdit.error = {};
Client.updateOidcClient($scope.clientEdit.id, $scope.clientEdit.secret, $scope.clientEdit.loginRedirectUri, $scope.clientEdit.logoutRedirectUri, function (error) {
if (error) {
console.error('Unable to edit openid client.', error);
$scope.clientEdit.busy = false;
return;
}
$scope.refreshClients();
$scope.clientEdit.busy = false;
$('#clientEditModal').modal('hide');
});
}
};
$scope.deleteClient = {
busy: false,
error: {},
id: '',
show: function (clientId) {
show: function (client) {
$scope.deleteClient.busy = false;
$scope.deleteClient.id = clientId;
$scope.deleteClient.id = client.id;
$('#clientDeleteModal').modal('show');
},
@@ -94,7 +135,7 @@ angular.module('Application').controller('OidcController', ['$scope', '$location
});
// setup all the dialog focus handling
['clientAddModal', 'clientEditModal'].forEach(function (id) {
['clientAddModal', 'clientEditmodal'].forEach(function (id) {
$('#' + id).on('shown.bs.modal', function () {
$(this).find('[autofocus]:first').focus();
});