diff --git a/readme.md b/readme.md
index ed08b0eb6..4ed335c9e 100644
--- a/readme.md
+++ b/readme.md
@@ -73,9 +73,12 @@ bower update;
# serverside dependencies
npm update;
```
+## Deleting all data and resetting Cryptpad
+
To reset your instance of Cryptpad and remove all the data that is being stored:
+**WARNING: This will reset your Cryptpad instance and remove all data**
```
# change into your cryptpad directory
cd /your/cryptpad/instance/location;
diff --git a/www/common/fsStore.js b/www/common/fsStore.js
index 623152a35..1be9e797f 100644
--- a/www/common/fsStore.js
+++ b/www/common/fsStore.js
@@ -153,7 +153,7 @@ define([
f(void 0, store);
}
- var requestLogin = function (Cryptpad) {
+ var requestLogin = function () {
// log out so that you don't go into an endless loop...
Cryptpad.logout();
@@ -162,11 +162,11 @@ define([
window.location.href = '/login/';
};
+ var tokenKey = 'loginToken';
if (Cryptpad.isLoggedIn()) {
/* This isn't truly secure, since anyone who can read the user's object can
set their local loginToken to match that in the object. However, it exposes
a UI that will work most of the time. */
- var tokenKey = 'loginToken';
// every user object should have a persistent, random number
if (typeof(proxy.loginToken) !== 'number') {
@@ -203,6 +203,13 @@ define([
if (typeof(n) !== "string") { return; }
Cryptpad.changeDisplayName(n);
});
+ proxy.on('change', [tokenKey], function () {
+ console.log('wut');
+ var localToken = tryParsing(localStorage.getItem(tokenKey));
+ if (localToken !== proxy[tokenKey]) {
+ return void requestLogin();
+ }
+ });
};
var initialized = false;
diff --git a/www/examples/index.html b/www/examples/index.html
index e4266b005..9730bc56b 100644
--- a/www/examples/index.html
+++ b/www/examples/index.html
@@ -11,12 +11,10 @@