🔥 Get rid of global API key leftovers
Also get rid of static apps key configuration. That has long been replaced by the bundled appkeys plugin.
This commit is contained in:
1 parent
d281b17d67
commit
294140d938
3 files changed
-58
No files matched your search
@@ -1,15 +1,11 @@
|
||||
__license__ = "GNU Affero General Public License http://www.gnu.org/licenses/agpl.html"
|
||||
__copyright__ = "Copyright (C) 2022 The OctoPrint Project - Released under terms of the AGPLv3 License"
|
||||
|
||||
from typing import Dict
|
||||
|
||||
from pydantic import BaseModel
|
||||
from pydantic_settings import with_attrs_docs
|
||||
|
||||
|
||||
@with_attrs_docs
|
||||
class ApiConfig(BaseModel):
|
||||
apps: Dict[str, str] = {}
|
||||
|
||||
allowCrossOrigin: bool = False
|
||||
"""Whether to allow cross origin access to the API or not."""
|
||||
@@ -133,7 +133,6 @@ $(function () {
|
||||
);
|
||||
self.locale_languages = _.keys(AVAILABLE_LOCALES);
|
||||
|
||||
self.api_key = ko.observable(undefined);
|
||||
self.api_allowCrossOrigin = ko.observable(undefined);
|
||||
|
||||
self.appearance_name = ko.observable(undefined);
|
||||
@@ -867,26 +866,6 @@ $(function () {
|
||||
self.settingsDialog.modal("hide");
|
||||
};
|
||||
|
||||
self.generateApiKey = function () {
|
||||
if (!CONFIG_ACCESS_CONTROL) return;
|
||||
|
||||
showConfirmationDialog(
|
||||
gettext(
|
||||
"This will generate a new API Key. The old API Key will cease to function immediately."
|
||||
),
|
||||
function () {
|
||||
OctoPrint.settings.generateApiKey().done(function (response) {
|
||||
self.api_key(response.apikey);
|
||||
self.requestData();
|
||||
});
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
self.copyApiKey = function () {
|
||||
copyToClipboard(self.api_key());
|
||||
};
|
||||
|
||||
self.showTranslationManager = function () {
|
||||
self.translationManagerDialog.modal();
|
||||
return false;
|
||||
|
||||
@@ -9,37 +9,4 @@
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<h3>{{ _('Global API Key') }}</h3>
|
||||
<div class="alert">
|
||||
<p>{% trans %}
|
||||
It is recommended to no longer use the global API key as it's one single key that gives full admin access
|
||||
to your whole OctoPrint instance. <strong>It will be removed in OctoPrint 2.0</strong>.
|
||||
Instead of using the global key you should create individual Application Keys for
|
||||
your third party clients. That way they get permissions matching the user account used for key
|
||||
creation and you can also revoke access to one app without having to change the keys for all other apps.
|
||||
It's also recommended to create a user account without admin access and use that for third
|
||||
party clients where possible.
|
||||
{% endtrans %}</p>
|
||||
<p><a href="javascript:void(0)" data-bind="click: function() { $root.selectTab('#settings_plugin_appkeys') }">{{ _('Access Application Keys') }}</a></p>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="settings-apikey">{{ _('Global API Key') }}</label>
|
||||
<div class="controls">
|
||||
<div class="input-append input-block-level">
|
||||
<input type="text" readonly="readonly" id="settings-apikey" data-bind="value: api_key, attr: {placeholder: '{{ _('N/A')|esq }}'}">
|
||||
<a class="btn add-on" title="Copy API Key to clipboard" data-bind="click: copyApiKey, css: {'disabled': !api_key()}"><i class="fas fa-copy"></i></a>
|
||||
<a class="btn add-on" title="Generate new API Key" data-bind="click: generateApiKey"><i class="fas fa-sync"></i></a>
|
||||
</div>
|
||||
<span class="help-block">{{ _('Please note that changes to the API key are applied immediately, without having to "Save" first.') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group" data-bind="visible: api_key">
|
||||
<label class="control-label">{{ _('QR Code') }}</label>
|
||||
<div class="controls">
|
||||
<div data-bind="qrcode: {text: api_key, size: 180}"></div>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
</form>
|
||||
Reference in new issue
Block a user