mirror of https://github.com/zulip/zulip.git
Allow users to regenerate a bot's API key.
(imported from commit 6f91c6099e305d43730c022f0d7881eed5872fa8)
This commit is contained in:
parent
df91b8c14e
commit
b13efe4ee3
|
@ -178,6 +178,23 @@ $(function () {
|
|||
}
|
||||
});
|
||||
});
|
||||
|
||||
$("#bots_list").on("click", "button.update_bot_api_key", function (e) {
|
||||
var email = $(e.target).data('email');
|
||||
$.ajax({
|
||||
url: '/json/bots/' + encodeURIComponent(email) + '/api_key/regenerate',
|
||||
type: 'POST',
|
||||
success: function (data) {
|
||||
var row = $(e.target).closest("li");
|
||||
row.find(".api_key").find(".value").text(data.api_key);
|
||||
row.find("api_key_error").hide();
|
||||
},
|
||||
error: function (xhr) {
|
||||
var row = $(e.target).closest("li");
|
||||
row.find(".api_key_error").text(JSON.parse(xhr.responseText).msg).show();
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
}());
|
||||
|
|
|
@ -10,7 +10,11 @@
|
|||
</div>
|
||||
<div class="api_key">
|
||||
<span class="field">API Key</span>
|
||||
<span class="value">{{api_key}}</e>
|
||||
<span class="value">{{api_key}}</span>
|
||||
<button type="submit" class="btn btn-secondary update_bot_api_key" data-email="{{email}}">
|
||||
Update API Key
|
||||
</button>
|
||||
<div class="api_key_error text-error"></div>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary delete_bot" data-email="{{email}}">
|
||||
Delete Bot
|
||||
|
|
Loading…
Reference in New Issue