Improve handling of logout during asynchronous tasks (Z#23238978) (#6341)

* Handle logout during async task requests properly

* Handle fragments safely on webcheckin logout

* Remove unnecessary comment

* Revert hash change
This commit is contained in:
Raphael Michel
2026-07-07 16:14:00 +02:00
committed by GitHub
parent 2bd5e90a86
commit ea2c81e6dc
5 changed files with 31 additions and 10 deletions
@@ -58,13 +58,14 @@ var i18nToString = function (i18nstring) {
};
$(document).ajaxError(function (event, jqXHR, settings, thrownError) {
waitingDialog.hide();
var c = $(jqXHR.responseText).filter('.container');
if (jqXHR.responseText && jqXHR.responseText.indexOf("<!-- pretix-login-marker -->") !== -1) {
location.href = '/control/login?next=' + encodeURIComponent(location.pathname + location.search + location.hash)
if (jqXHR.status === 401 && jqXHR.getResponseHeader("X-Login-Url")) {
window.location = jqXHR.getResponseHeader("X-Login-Url") + "?next=" + encodeURIComponent(location.pathname + location.search + location.hash);
} else if (c.length > 0) {
waitingDialog.hide();
ajaxErrDialog.show(c.first().html());
} else if (thrownError !== "abort" && thrownError !== "") {
waitingDialog.hide();
console.error(event, jqXHR, settings, thrownError);
alert(gettext('Unknown error.'));
}