From f5c029e937de0bf02079e2f1e7ebca2bb09f7558 Mon Sep 17 00:00:00 2001 From: yflory Date: Tue, 18 May 2021 10:47:11 +0200 Subject: [PATCH] Add config options to prevent anonymous users from creating pads #704 --- www/common/application_config_internal.js | 2 ++ www/common/sframe-common.js | 3 +++ 2 files changed, 5 insertions(+) diff --git a/www/common/application_config_internal.js b/www/common/application_config_internal.js index 791ecf367..904fe7e45 100644 --- a/www/common/application_config_internal.js +++ b/www/common/application_config_internal.js @@ -134,6 +134,8 @@ define(function() { // Prevent anonymous users from storing pads in their drive AppConfig.disableAnonymousStore = false; + // Prevent anonymous users from creating new pads (they can still access and edit existing ones) + AppConfig.disableAnonymousPadCreation = false; // Hide the usage bar in settings and drive //AppConfig.hideUsageBar = true; diff --git a/www/common/sframe-common.js b/www/common/sframe-common.js index 70c239d67..227656040 100644 --- a/www/common/sframe-common.js +++ b/www/common/sframe-common.js @@ -448,6 +448,9 @@ define([ } }; funcs.createPad = function (cfg, cb) { + if (AppConfig.disableAnonymousPadCreation && !funcs.isLoggedIn()) { + return void UI.errorLoadingScreen(Messages.mustLogin); + } ctx.sframeChan.query("Q_CREATE_PAD", { owned: cfg.owned, expire: cfg.expire,