Fix generate/delete API key functionality in user settings
Closes #1491
This commit is contained in:
parent
8b99c89acf
commit
0167015b46
2 changed files with 16 additions and 2 deletions
|
|
@ -68,6 +68,20 @@ $(function() {
|
|||
});
|
||||
};
|
||||
|
||||
self.generateApikey = function() {
|
||||
if (!CONFIG_ACCESS_CONTROL) return;
|
||||
self.users.generateApikey(self.currentUser().name, function(response) {
|
||||
self.access_apikey(response.apikey);
|
||||
});
|
||||
};
|
||||
|
||||
self.deleteApikey = function() {
|
||||
if (!CONFIG_ACCESS_CONTROL) return;
|
||||
self.users.deleteApikey(self.currentUser().name, function() {
|
||||
self.access_apikey(undefined);
|
||||
});
|
||||
};
|
||||
|
||||
self.updateSettings = function(username, settings, callback) {
|
||||
if (!CONFIG_ACCESS_CONTROL) return;
|
||||
|
||||
|
|
|
|||
|
|
@ -25,8 +25,8 @@
|
|||
<div class="controls">
|
||||
<div class="input-append">
|
||||
<input type="text" class="input-block-level uneditable-input" id="userSettings-access_apikey" data-bind="value: access_apikey, valueUpdate: 'input', attr: {placeholder: '{{ _('N/A') }}'}">
|
||||
<a class="btn" title="Generate new Apikey" data-bind="click: function() { users.confirmGenerateApikey(); }"><i class="icon-refresh"></i></a>
|
||||
<a class="btn btn-danger" title="Delete Apikey" data-bind="click: function() { users.confirmDeleteApikey(); }"><i class="icon-trash"></i></a>
|
||||
<a class="btn" title="Generate new Apikey" data-bind="click: generateApikey"><i class="icon-refresh"></i></a>
|
||||
<a class="btn btn-danger" title="Delete Apikey" data-bind="click: deleteApikey"><i class="icon-trash"></i></a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in a new issue