Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/OctoPrint/OctoPrint.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGina Häußge <gina@octoprint.org>2022-09-27 14:43:32 +0300
committerGina Häußge <gina@octoprint.org>2022-09-27 14:43:32 +0300
commitbe0d452ab9927c03aee219a27490a1d76de52388 (patch)
tree75e1b242c77773d33d3aceeb43e94273ec991791
parent0093d96da4e12195f97010089a50dbb5164fb77d (diff)
🐛 Fix stale session reporting
Fix handling of `stale` reauthRequired in UI and document it. Also send it in case of an `auth` message with an unknown session. Closes #4653
-rw-r--r--docs/api/push.rst2
-rw-r--r--src/octoprint/server/util/sockjs.py1
-rw-r--r--src/octoprint/static/js/app/viewmodels/loginstate.js2
3 files changed, 3 insertions, 2 deletions
diff --git a/docs/api/push.rst b/docs/api/push.rst
index a9796b663..158fb3984 100644
--- a/docs/api/push.rst
+++ b/docs/api/push.rst
@@ -30,7 +30,7 @@ following message types are currently available for usage by 3rd party clients:
* ``connected``: Initial connection information, sent only right after establishing the socket connection. See
:ref:`the payload data model <sec-api-push-datamodel-connected>`.
* ``reauthRequired``: A reauthentication of the current login session is required. The ``reason`` parameter in the
- payload defines whether a full active login is necessary (values ``logout`` and ``removed``) or a simple passive
+ payload defines whether a full active login is necessary (values ``logout``, ``stale``, ``removed``) or a simple passive
login will suffice (all other values).
* ``current``: Rate limited general state update, payload contains information about the printer's state, job progress,
accumulated temperature points and log lines since last update. OctoPrint will send these updates when new information
diff --git a/src/octoprint/server/util/sockjs.py b/src/octoprint/server/util/sockjs.py
index 0bc529f56..f6aa9a971 100644
--- a/src/octoprint/server/util/sockjs.py
+++ b/src/octoprint/server/util/sockjs.py
@@ -305,6 +305,7 @@ class PrinterStateConnection(
f"Unknown user/session combo: {user_id}:{user_session}"
)
self._on_logout()
+ self._sendReauthRequired("stale")
self._register()
diff --git a/src/octoprint/static/js/app/viewmodels/loginstate.js b/src/octoprint/static/js/app/viewmodels/loginstate.js
index e78f71cc2..6bfb286fb 100644
--- a/src/octoprint/static/js/app/viewmodels/loginstate.js
+++ b/src/octoprint/static/js/app/viewmodels/loginstate.js
@@ -308,7 +308,7 @@ $(function () {
};
self.onDataUpdaterReauthRequired = function (reason) {
- if (reason === "logout" || reason === "removed") {
+ if (reason === "logout" || reason === "stale" || reason === "removed") {
self.logout();
} else {
self.requestData();