mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2024-11-20 10:40:29 +01:00
c17b8e4d9e
fixes #1958 Adds 2 new options: * Do not allow stores to use the email settings of the server. Instead, they would need to fill in the email settings in their own store * Do not allow user creation through the API unless you are an admin. Both are opt-in and turned off by default.
35 lines
1.2 KiB
C#
35 lines
1.2 KiB
C#
using BTCPayServer.HostedServices;
|
|
using BTCPayServer.Services.Stores;
|
|
|
|
namespace BTCPayServer.Services.Mails
|
|
{
|
|
public class EmailSenderFactory
|
|
{
|
|
private readonly IBackgroundJobClient _jobClient;
|
|
private readonly SettingsRepository _repository;
|
|
private readonly StoreRepository _storeRepository;
|
|
private readonly CssThemeManager _cssThemeManager;
|
|
|
|
public EmailSenderFactory(IBackgroundJobClient jobClient,
|
|
SettingsRepository repository,
|
|
StoreRepository storeRepository,
|
|
CssThemeManager cssThemeManager)
|
|
{
|
|
_jobClient = jobClient;
|
|
_repository = repository;
|
|
_storeRepository = storeRepository;
|
|
_cssThemeManager = cssThemeManager;
|
|
}
|
|
|
|
public IEmailSender GetEmailSender(string storeId = null)
|
|
{
|
|
var serverSender = new ServerEmailSender(_repository, _jobClient);
|
|
if (string.IsNullOrEmpty(storeId))
|
|
return serverSender;
|
|
return new StoreEmailSender(_storeRepository,
|
|
!_cssThemeManager.Policies.DisableStoresToUseServerEmailSettings ? serverSender : null, _jobClient,
|
|
storeId);
|
|
}
|
|
}
|
|
}
|