btcpayserver/BTCPayServer/Views/UIStores/StoreEmailSettings.cshtml
rockstardev a7e3cbb105
Adding endpoint to set server email settings (#6601)
* Adding endpoint in Greenfield to allow server email settings

* Adding related swagger file

* Refactoring EmailSettingsData to be more readable

* Adding server email masking

* Adding tests

* Update BTCPayServer/wwwroot/swagger/v1/swagger.template.serveremail.json

Co-authored-by: d11n <mail@dennisreimann.de>

* Masking smtp server email returned over greenfield api and test

* Retaining password if password mask is used

* Remove magic string *****

* Flatten request for server's settings. Fix bug on shared setting instances

* Remove useless doc

* Simplify code

* Fix Store Email settings page

---------

Co-authored-by: d11n <mail@dennisreimann.de>
Co-authored-by: nicolas.dorier <nicolas.dorier@gmail.com>
2025-02-27 15:59:17 +09:00

48 lines
2 KiB
Text

@using BTCPayServer.Client
@using Microsoft.AspNetCore.Mvc.TagHelpers
@model BTCPayServer.Models.EmailsViewModel
@{
var storeId = Context.GetStoreData().Id;
ViewData.SetActivePage(StoreNavPages.Emails, StringLocalizer["Email Rules"], storeId);
}
<form method="post" autocomplete="off" permissioned="@Policies.CanModifyStoreSettings">
<div class="sticky-header">
<h2 text-translate="true">Email Server</h2>
<button id="page-primary" type="submit" class="btn btn-primary" name="command" value="Save">Save</button>
</div>
<partial name="_StatusMessage" />
@if (Model.IsFallbackSetup)
{
<label class="d-flex align-items-center mb-4">
<input type="checkbox" asp-for="IsCustomSMTP" class="btcpay-toggle me-3" data-bs-toggle="collapse" data-bs-target="#SmtpSettings" aria-expanded="@Model.IsCustomSMTP" aria-controls="SmtpSettings" />
<div>
<span text-translate="true">Use custom SMTP settings for this store</span>
<div class="form-text" text-translate="true">Otherwise, the server's SMTP settings will be used to send emails.</div>
</div>
</label>
<div class="collapse @(Model.IsCustomSMTP ? "show" : "")" id="SmtpSettings">
<partial name="EmailsBody" model="Model" />
</div>
}
else
{
<input type="hidden" id="IsCustomSMTPHidden" asp-for="IsCustomSMTP" />
<partial name="EmailsBody" model="Model" />
}
<partial name="EmailsTest" model="Model" permission="@Policies.CanModifyStoreSettings" />
</form>
<div class="mt-5" permission="@Policies.CanModifyStoreSettings">
<h3 text-translate="true">Email Rules</h3>
<p text-translate="true">Email rules allow BTCPay Server to send customized emails from your store based on events.</p>
<a class="btn btn-secondary" asp-action="StoreEmails" asp-controller="UIStores" asp-route-storeId="@storeId" id="ConfigureEmailRules" permission="@Policies.CanModifyStoreSettings" text-translate="true">
Configure
</a>
</div>
@section PageFootContent {
<partial name="_ValidationScriptsPartial" />
}