diff --git a/BTCPayServer/HostedServices/CssThemeManager.cs b/BTCPayServer/HostedServices/CssThemeManager.cs index e3afcf35b..b0e32673b 100644 --- a/BTCPayServer/HostedServices/CssThemeManager.cs +++ b/BTCPayServer/HostedServices/CssThemeManager.cs @@ -41,6 +41,13 @@ namespace BTCPayServer.HostedServices { get { return _creativeStartUri; } } + + public bool ShowRegister { get; set; } + + internal void Update(PoliciesSettings data) + { + ShowRegister = !data.LockSubscription; + } } public class CssThemeManagerHostedService : BaseAsyncService @@ -58,10 +65,19 @@ namespace BTCPayServer.HostedServices { return new[] { - CreateLoopTask(ListenForThemeChanges) + CreateLoopTask(ListenForThemeChanges), + CreateLoopTask(ListenForPoliciesChanges), }; } + async Task ListenForPoliciesChanges() + { + await new SynchronizationContextRemover(); + var data = (await _SettingsRepository.GetSettingAsync()) ?? new PoliciesSettings(); + _CssThemeManager.Update(data); + await _SettingsRepository.WaitSettingsChanged(Cancellation); + } + async Task ListenForThemeChanges() { await new SynchronizationContextRemover(); diff --git a/BTCPayServer/Services/PoliciesSettings.cs b/BTCPayServer/Services/PoliciesSettings.cs index 431e902eb..b1ef0a423 100644 --- a/BTCPayServer/Services/PoliciesSettings.cs +++ b/BTCPayServer/Services/PoliciesSettings.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; using System.Linq; using System.Threading.Tasks; using Newtonsoft.Json; @@ -8,12 +9,14 @@ namespace BTCPayServer.Services { public class PoliciesSettings { + [Display(Name = "Requires a confirmation mail for registering")] public bool RequiresConfirmedEmail { get; set; } [JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)] + [Display(Name = "Disable registration")] public bool LockSubscription { get; set; } } } diff --git a/BTCPayServer/Views/Shared/_Layout.cshtml b/BTCPayServer/Views/Shared/_Layout.cshtml index 46a85807c..2af9e84cd 100644 --- a/BTCPayServer/Views/Shared/_Layout.cshtml +++ b/BTCPayServer/Views/Shared/_Layout.cshtml @@ -31,7 +31,7 @@ @{ - if (ViewBag.AlwaysShrinkNavBar == null) + if(ViewBag.AlwaysShrinkNavBar == null) { ViewBag.AlwaysShrinkNavBar = true; } @@ -43,7 +43,7 @@