don't allow editing if pad type is wrong

This commit is contained in:
ansuz
2017-06-22 14:31:55 +02:00
parent eddfb936f2
commit 852c028822
8 changed files with 51 additions and 18 deletions

View File

@@ -430,6 +430,7 @@ define([
});
proxy.version = 1;
proxy.type = 'poll';
};
/*
@@ -475,6 +476,16 @@ var ready = function (info, userid, readOnly) {
var userDoc = JSON.stringify(proxy);
if (userDoc === "" || userDoc === "{}") { isNew = true; }
if (!isNew && typeof(proxy.type) !== 'undefined' && proxy.type !== 'poll') {
var errorText = Messages.typeError;
Cryptpad.errorLoadingScreen(errorText);
throw new Error(errorText);
}
if (typeof(proxy.type) === 'undefined') {
proxy.type = 'poll';
}
var uncommitted = APP.uncommitted = {};
prepareProxy(proxy, copyObject(Render.Example));
prepareProxy(uncommitted, copyObject(Render.Example));