From b406f52670508093038cdb008e08b0a5fe4ab654 Mon Sep 17 00:00:00 2001 From: Umar Bolatov Date: Mon, 2 Nov 2020 21:53:49 -0800 Subject: [PATCH] Add warning to configure e-mail server (#2024) Adds a warning to configure the e-mail server before "Requires a confirmation mail for registering" checkbox can be checked if e-mail server is not configured. close #1889 --- BTCPayServer/Views/Server/Policies.cshtml | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/BTCPayServer/Views/Server/Policies.cshtml b/BTCPayServer/Views/Server/Policies.cshtml index 97105ae8d..f196c37a9 100644 --- a/BTCPayServer/Views/Server/Policies.cshtml +++ b/BTCPayServer/Views/Server/Policies.cshtml @@ -1,5 +1,7 @@ @using BTCPayServer.Services +@using BTCPayServer.Services.Mails; @model BTCPayServer.Services.PoliciesSettings +@inject BTCPayServer.Services.SettingsRepository _SettingsRepository @{ ViewData.SetActivePageAndTitle(ServerNavPages.Policies); } @@ -14,9 +16,22 @@
- + @{ + var emailSettings = (await _SettingsRepository.GetSettingAsync()) ?? new EmailSettings(); + /** + * The "|| Model.RequiresConfirmedEmail" check is for the case when a user had checked + * the checkbox without first configuring the e-mail settings so that they can uncheck it. + **/ + var isEmailConfigured = emailSettings.IsComplete() || Model.RequiresConfirmedEmail; + } + + @if (!isEmailConfigured) { +
+ Your email server has not been configured. Please configure it first. +
+ }