From cc06942ebdeea55f68a2d3b634e163e23f3be9b9 Mon Sep 17 00:00:00 2001 From: yflory Date: Mon, 14 Jun 2021 15:00:01 +0200 Subject: [PATCH] Fix type error in forms --- www/form/inner.js | 5 ++++- www/form/main.js | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/www/form/inner.js b/www/form/inner.js index c52f6923d..76045f1e9 100644 --- a/www/form/inner.js +++ b/www/form/inner.js @@ -1870,7 +1870,7 @@ define([ } evOnChange.fire(false, true); window.onbeforeunload = undefined; - if (!update) { + if (!update && content.answers.privateKey) { // Add results button addResultsButton(framework, content); } @@ -2712,6 +2712,9 @@ define([ answers = obj; // If we have a non-anon answer, we can't answer anonymously later if (!obj._isAnon) { APP.cantAnon = true; } + + // Add results button + if (content.answers.privateKey) { addResultsButton(framework, content); } } checkIntegrity(false); updateForm(framework, content, false, answers); diff --git a/www/form/main.js b/www/form/main.js index 77f4381d0..9ccac3d00 100644 --- a/www/form/main.js +++ b/www/form/main.js @@ -163,6 +163,7 @@ define([ var keys = Utils.secret && Utils.secret.keys; var curvePrivate = privateKey || data.privateKey; + if (!curvePrivate) { return void cb({error: 'EFORBIDDEN'}); } var crypto = Utils.Crypto.Mailbox.createEncryptor({ curvePrivate: curvePrivate, curvePublic: publicKey || data.publicKey,