From f2ccc4d963cb0a0936d30c3e4be9e9ae3dd249fd Mon Sep 17 00:00:00 2001 From: Kukks Date: Sun, 6 Jan 2019 14:44:51 +0100 Subject: [PATCH] Add sanity check in loading crowdfun --- BTCPayServer/Controllers/AppsPublicController.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/BTCPayServer/Controllers/AppsPublicController.cs b/BTCPayServer/Controllers/AppsPublicController.cs index fa3722fba..b4eefc169 100644 --- a/BTCPayServer/Controllers/AppsPublicController.cs +++ b/BTCPayServer/Controllers/AppsPublicController.cs @@ -115,10 +115,19 @@ namespace BTCPayServer.Controllers if (app == null) return NotFound(); var settings = app.GetSettings(); - var isAdmin = false; + + var hasEnoughSettingsToLoad = !string.IsNullOrEmpty(settings.TargetCurrency ); + + var isAdmin = await _AppsHelper.GetAppDataIfOwner(GetUserId(), appId, AppType.Crowdfund) != null; + if (!hasEnoughSettingsToLoad) + { + if(!isAdmin) + return NotFound(); + + return NotFound("A Target Currency must be set for this app in order to be loadable."); + } if (!settings.Enabled) { - isAdmin = await _AppsHelper.GetAppDataIfOwner(GetUserId(), appId, AppType.Crowdfund) != null; if(!isAdmin) return NotFound("Crowdfund is not currently active"); }