mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-02-23 14:40:36 +01:00
* Store Email Settings: Improve configuration This works with the existing settings and provides better guidance about the different store email cases. Closes #5623. * Split email and notification settings
32 lines
1 KiB
C#
32 lines
1 KiB
C#
using System.ComponentModel.DataAnnotations;
|
|
using BTCPayServer.Services.Mails;
|
|
using BTCPayServer.Validation;
|
|
|
|
namespace BTCPayServer.Models.ServerViewModels
|
|
{
|
|
public class EmailsViewModel
|
|
{
|
|
public EmailSettings Settings { get; set; }
|
|
public EmailSettings FallbackSettings { get; set; }
|
|
public bool PasswordSet { get; set; }
|
|
|
|
[MailboxAddress]
|
|
[Display(Name = "Test Email")]
|
|
public string TestEmail { get; set; }
|
|
|
|
public EmailsViewModel()
|
|
{
|
|
}
|
|
|
|
public EmailsViewModel(EmailSettings settings, EmailSettings fallbackSettings = null)
|
|
{
|
|
Settings = settings;
|
|
FallbackSettings = fallbackSettings;
|
|
PasswordSet = !string.IsNullOrEmpty(settings?.Password);
|
|
}
|
|
|
|
public bool IsSetup() => Settings?.IsComplete() is true;
|
|
public bool IsFallbackSetup() => FallbackSettings?.IsComplete() is true;
|
|
public bool UsesFallback() => IsFallbackSetup() && Settings == FallbackSettings;
|
|
}
|
|
}
|