mirror of
https://github.com/zulip/zulip.git
synced 2025-11-05 22:43:42 +00:00
Allow user to change their API key.
(imported from commit b7c50779d0209c6e6600b59c8760a81273fe2454)
This commit is contained in:
@@ -220,7 +220,18 @@ $(function () {
|
||||
|
||||
});
|
||||
|
||||
|
||||
$("#show_api_key_box").on("click", "button.regenerate_api_key", function (e) {
|
||||
$.ajax({
|
||||
url: '/json/users/me/api_key/regenerate',
|
||||
type: 'POST',
|
||||
success: function (data) {
|
||||
$('#api_key_value').text(data.api_key);
|
||||
},
|
||||
error: function (xhr) {
|
||||
$('#user_api_key_error').text(JSON.parse(xhr.responseText).msg).show();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
@@ -171,7 +171,7 @@
|
||||
want to write a bot that can e.g. read your own private
|
||||
messages, you should use your personal API key.</p>
|
||||
<div class="controls">
|
||||
<button class="btn" id="api_key_button">Show your API key</button>
|
||||
<button class="btn" id="api_key_button">Show/change your API key</button>
|
||||
</div>
|
||||
</div>
|
||||
<div id="get_api_key_box">
|
||||
@@ -196,8 +196,12 @@
|
||||
<div id="show_api_key_box">
|
||||
<p>Your API key:</p>
|
||||
<p><b><span id="api_key_value"></span></b></p>
|
||||
<button type="submit" class="btn btn-primary regenerate_api_key">
|
||||
Generate new API Key
|
||||
</button>
|
||||
<div id="user_api_key_error text-error"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr class="settings_separator">
|
||||
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user