mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-19 15:04:19 +01:00
Store: Allow resetting custom email server (#6547)
* Store: Allow resetting custom email server Fixes #6546. * Do not show fallback settings in form
This commit is contained in:
@@ -179,7 +179,8 @@ public partial class UIStoresController
|
||||
var fallbackSettings = emailSender is StoreEmailSender { FallbackSender: { } fallbackSender }
|
||||
? await fallbackSender.GetEmailSettings()
|
||||
: null;
|
||||
return View(new EmailsViewModel(data, fallbackSettings));
|
||||
var settings = data != fallbackSettings ? data : new EmailSettings();
|
||||
return View(new EmailsViewModel(settings, fallbackSettings));
|
||||
}
|
||||
|
||||
[HttpPost("{storeId}/email-settings")]
|
||||
@@ -236,7 +237,8 @@ public partial class UIStoresController
|
||||
await _storeRepo.UpdateStore(store);
|
||||
TempData[WellKnownTempData.SuccessMessage] = StringLocalizer["Email server password reset"].Value;
|
||||
}
|
||||
if (useCustomSMTP)
|
||||
var unsetCustomSMTP = !useCustomSMTP && store.GetStoreBlob().EmailSettings is not null;
|
||||
if (useCustomSMTP || unsetCustomSMTP)
|
||||
{
|
||||
if (model.Settings.From is not null && !MailboxAddressValidator.IsMailboxAddress(model.Settings.From))
|
||||
{
|
||||
@@ -249,7 +251,7 @@ public partial class UIStoresController
|
||||
{
|
||||
model.Settings.Password = storeBlob.EmailSettings.Password;
|
||||
}
|
||||
storeBlob.EmailSettings = model.Settings;
|
||||
storeBlob.EmailSettings = unsetCustomSMTP ? null : model.Settings;
|
||||
store.SetStoreBlob(storeBlob);
|
||||
await _storeRepo.UpdateStore(store);
|
||||
TempData[WellKnownTempData.SuccessMessage] = StringLocalizer["Email settings modified"].Value;
|
||||
|
||||
Reference in New Issue
Block a user