mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-02-22 06:21:44 +01:00
Masking smtp server email returned over greenfield api and test
This commit is contained in:
parent
884126864e
commit
47ff3c3595
2 changed files with 9 additions and 2 deletions
|
@ -4156,6 +4156,8 @@ namespace BTCPayServer.Tests
|
|||
};
|
||||
await adminClient.UpdateStoreEmailSettings(admin.StoreId, data);
|
||||
var s = await adminClient.GetStoreEmailSettings(admin.StoreId);
|
||||
// email password is masked and not returned from the server once set
|
||||
data.Password = ServerEmailSettingsData.PasswordMask;
|
||||
Assert.Equal(JsonConvert.SerializeObject(s), JsonConvert.SerializeObject(data));
|
||||
await AssertValidationError(new[] { nameof(EmailSettingsData.From) },
|
||||
async () => await adminClient.UpdateStoreEmailSettings(admin.StoreId,
|
||||
|
|
|
@ -55,7 +55,6 @@ namespace BTCPayServer.Controllers.GreenField
|
|||
[HttpGet("~/api/v1/stores/{storeId}/email")]
|
||||
public IActionResult GetStoreEmailSettings()
|
||||
{
|
||||
|
||||
var store = HttpContext.GetStoreData();
|
||||
return store == null ? StoreNotFound() : Ok(FromModel(store));
|
||||
}
|
||||
|
@ -87,7 +86,13 @@ namespace BTCPayServer.Controllers.GreenField
|
|||
}
|
||||
private EmailSettings FromModel(Data.StoreData data)
|
||||
{
|
||||
return data.GetStoreBlob().EmailSettings ?? new();
|
||||
var emailSettings = data.GetStoreBlob().EmailSettings;
|
||||
if (emailSettings == null)
|
||||
return new EmailSettings();
|
||||
|
||||
emailSettings.Password = ServerEmailSettingsData.PasswordMask;
|
||||
|
||||
return emailSettings;
|
||||
}
|
||||
private IActionResult StoreNotFound()
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue