|
|
|
@ -117,6 +117,10 @@ app.cacheBuster = null;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
app.alertError = function (message, timeout) {
|
|
|
|
|
if (message === '[[error:invalid-session]]') {
|
|
|
|
|
return app.handleInvalidSession();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
app.alert({
|
|
|
|
|
title: '[[global:alert.error]]',
|
|
|
|
|
message: message,
|
|
|
|
@ -125,6 +129,28 @@ app.cacheBuster = null;
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
app.handleInvalidSession = function() {
|
|
|
|
|
if (app.flags && app.flags._sessionRefresh) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
app.flags = app.flags || {};
|
|
|
|
|
app.flags._sessionRefresh = true;
|
|
|
|
|
|
|
|
|
|
require(['translator'], function(translator) {
|
|
|
|
|
translator.translate('[[error:invalid-session-text]]', function(translated) {
|
|
|
|
|
bootbox.alert({
|
|
|
|
|
title: '[[error:invalid-session]]',
|
|
|
|
|
message: translated,
|
|
|
|
|
closeButton: false,
|
|
|
|
|
callback: function() {
|
|
|
|
|
window.location.reload();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
app.enterRoom = function (room, callback) {
|
|
|
|
|
callback = callback || function() {};
|
|
|
|
|
if (socket && app.user.uid && app.currentRoom !== room) {
|
|
|
|
|