diff --git a/customize.dist/fsStore.js b/customize.dist/fsStore.js
index 83fcb8066..bbf3d34e6 100644
--- a/customize.dist/fsStore.js
+++ b/customize.dist/fsStore.js
@@ -176,7 +176,18 @@ define([
window.location.reload();
} else if (o && !n) {
//window.location.reload();
- window.location.href = '/';
+ //window.location.href = '/';
+ $(window).on('keyup', function (e) {
+ if (e.keyCode === 27) {
+ Cryptpad.removeLoadingScreen();
+ }
+ });
+ Cryptpad.logout();
+ Cryptpad.addLoadingScreen();
+ Cryptpad.errorLoadingScreen(Messages.onLogout, true);
+ if (exp.info) {
+ exp.info.network.disconnect();
+ }
}
});
diff --git a/customize.dist/translations/messages.fr.js b/customize.dist/translations/messages.fr.js
index 9e738720b..1bc60132e 100644
--- a/customize.dist/translations/messages.fr.js
+++ b/customize.dist/translations/messages.fr.js
@@ -25,6 +25,7 @@ define(function () {
out.websocketError = 'Impossible de se connecter au serveur WebSocket...';
out.typeError = "Ce document temps-réel n'est pas compatible avec l'application sélectionnée";
+ out.onLogout = 'Vous êtes déconnecté de votre compte utilisateur, cliquez ici pour vous authentifier
ou appuyez sur Échap pour accéder au document en mode lecture seule.';
out.loading = "Chargement...";
out.error = "Erreur";
diff --git a/customize.dist/translations/messages.js b/customize.dist/translations/messages.js
index 6d2faab1f..ee09575e7 100644
--- a/customize.dist/translations/messages.js
+++ b/customize.dist/translations/messages.js
@@ -29,6 +29,7 @@ define(function () {
out.websocketError = 'Unable to connect to the websocket server...';
out.typeError = "That realtime document is not compatible with the selected application";
+ out.onLogout = 'You are logged out, click here to log in
or press Escape to access your pad in read-only mode.';
out.loading = "Loading...";
out.error = "Error";
diff --git a/www/code/main.js b/www/code/main.js
index 2e9d2f97b..ba1208a2d 100644
--- a/www/code/main.js
+++ b/www/code/main.js
@@ -719,6 +719,8 @@ define([
var realtime = module.realtime = Realtime.start(config);
editor.on('change', onLocal);
+
+ Cryptpad.onLogout(function () { setEditable(false); });
};
var interval = 100;
diff --git a/www/common/cryptpad-common.js b/www/common/cryptpad-common.js
index 845eafe3e..ff2943c16 100644
--- a/www/common/cryptpad-common.js
+++ b/www/common/cryptpad-common.js
@@ -107,8 +107,18 @@ define([
}
eraseTempSessionValues();
+ logoutHandlers.forEach(function (h) {
+ if (typeof (h) === "function") { h(); }
+ });
+
if (cb) { cb(); }
};
+ var logoutHandlers= [];
+ var onLogout = common.onLogout = function (h) {
+ if (typeof (h) !== "function") { return; }
+ if (logoutHandlers.indexOf(h) !== -1) { return; }
+ logoutHandlers.push(h);
+ };
var getUserHash = common.getUserHash = function () {
var hash;
@@ -760,6 +770,10 @@ define([
var LOADING = 'loading';
common.addLoadingScreen = function () {
+ if ($('#' + LOADING).length) {
+ $('#' + LOADING).show();
+ return;
+ }
var $loading = $('