mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-05 05:25:49 +01:00
* fix: #9507 session reroll causes socket.io to become confused * fix: added return * fix: simpler logic for error handling * fix: overly sensitive catch
This commit is contained in:
@@ -181,9 +181,9 @@ app.cacheBuster = null;
|
||||
app.alertError = function (message, timeout) {
|
||||
message = (message && message.message) || message;
|
||||
|
||||
if (message === '[[error:invalid-session]]') {
|
||||
app.handleInvalidSession();
|
||||
app.logout(false);
|
||||
if (message === '[[error:revalidate-failure]]') {
|
||||
socket.disconnect();
|
||||
app.reconnect();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -197,14 +197,27 @@ app.cacheBuster = null;
|
||||
};
|
||||
|
||||
app.handleInvalidSession = function () {
|
||||
socket.disconnect();
|
||||
app.logout(false);
|
||||
bootbox.alert({
|
||||
title: '[[error:invalid-session]]',
|
||||
message: '[[error:invalid-session-text]]',
|
||||
closeButton: false,
|
||||
callback: function () {
|
||||
window.location.reload();
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
app.handleSessionMismatch = () => {
|
||||
if (app.flags._login || app.flags._logout) {
|
||||
return;
|
||||
}
|
||||
|
||||
socket.disconnect();
|
||||
bootbox.alert({
|
||||
title: '[[error:invalid-session]]',
|
||||
message: '[[error:invalid-session-text]]',
|
||||
title: '[[error:session-mismatch]]',
|
||||
message: '[[error:session-mismatch-text]]',
|
||||
closeButton: false,
|
||||
callback: function () {
|
||||
window.location.reload();
|
||||
|
||||
Reference in New Issue
Block a user