|
|
@ -1,9 +1,11 @@ |
|
|
using System; |
|
|
using System; |
|
|
|
|
|
using System.ComponentModel.DataAnnotations; |
|
|
using System.Threading.Tasks; |
|
|
using System.Threading.Tasks; |
|
|
using Blazorise; |
|
|
using Blazorise; |
|
|
using Microsoft.AspNetCore.Components; |
|
|
using Microsoft.AspNetCore.Components; |
|
|
using Volo.Abp.AspNetCore.Components.Messages; |
|
|
using Volo.Abp.AspNetCore.Components.Messages; |
|
|
using Volo.Abp.AspNetCore.Components.Web.Configuration; |
|
|
using Volo.Abp.AspNetCore.Components.Web.Configuration; |
|
|
|
|
|
using Volo.Abp.Auditing; |
|
|
using Volo.Abp.SettingManagement.Localization; |
|
|
using Volo.Abp.SettingManagement.Localization; |
|
|
|
|
|
|
|
|
namespace Volo.Abp.SettingManagement.Blazor.Pages.SettingManagement.EmailSettingGroup; |
|
|
namespace Volo.Abp.SettingManagement.Blazor.Pages.SettingManagement.EmailSettingGroup; |
|
|
@ -19,9 +21,9 @@ public partial class EmailSettingGroupViewComponent |
|
|
[Inject] |
|
|
[Inject] |
|
|
protected IUiMessageService UiMessageService { get; set; } |
|
|
protected IUiMessageService UiMessageService { get; set; } |
|
|
|
|
|
|
|
|
protected EmailSettingsDto EmailSettings; |
|
|
protected UpdateEmailSettingsViewModel EmailSettings; |
|
|
|
|
|
|
|
|
protected Validations IdentitySettingValidation; |
|
|
protected Validations EmailSettingValidation; |
|
|
|
|
|
|
|
|
public EmailSettingGroupViewComponent() |
|
|
public EmailSettingGroupViewComponent() |
|
|
{ |
|
|
{ |
|
|
@ -33,7 +35,7 @@ public partial class EmailSettingGroupViewComponent |
|
|
{ |
|
|
{ |
|
|
try |
|
|
try |
|
|
{ |
|
|
{ |
|
|
EmailSettings = await EmailSettingsAppService.GetAsync(); |
|
|
EmailSettings = ObjectMapper.Map<EmailSettingsDto, UpdateEmailSettingsViewModel>(await EmailSettingsAppService.GetAsync()); |
|
|
} |
|
|
} |
|
|
catch (Exception ex) |
|
|
catch (Exception ex) |
|
|
{ |
|
|
{ |
|
|
@ -45,7 +47,12 @@ public partial class EmailSettingGroupViewComponent |
|
|
{ |
|
|
{ |
|
|
try |
|
|
try |
|
|
{ |
|
|
{ |
|
|
await EmailSettingsAppService.UpdateAsync(ObjectMapper.Map<EmailSettingsDto, UpdateEmailSettingsDto>(EmailSettings)); |
|
|
if (!await EmailSettingValidation.ValidateAll()) |
|
|
|
|
|
{ |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
await EmailSettingsAppService.UpdateAsync(ObjectMapper.Map<UpdateEmailSettingsViewModel, UpdateEmailSettingsDto>(EmailSettings)); |
|
|
|
|
|
|
|
|
await CurrentApplicationConfigurationCacheResetService.ResetAsync(); |
|
|
await CurrentApplicationConfigurationCacheResetService.ResetAsync(); |
|
|
|
|
|
|
|
|
@ -56,4 +63,45 @@ public partial class EmailSettingGroupViewComponent |
|
|
await HandleErrorAsync(ex); |
|
|
await HandleErrorAsync(ex); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public class UpdateEmailSettingsViewModel |
|
|
|
|
|
{ |
|
|
|
|
|
[MaxLength(256)] |
|
|
|
|
|
[Display(Name = "SmtpHost")] |
|
|
|
|
|
public string SmtpHost { get; set; } |
|
|
|
|
|
|
|
|
|
|
|
[Range(1, 65535)] |
|
|
|
|
|
[Display(Name = "SmtpPort")] |
|
|
|
|
|
public int SmtpPort { get; set; } |
|
|
|
|
|
|
|
|
|
|
|
[MaxLength(1024)] |
|
|
|
|
|
[Display(Name = "SmtpUserName")] |
|
|
|
|
|
public string SmtpUserName { get; set; } |
|
|
|
|
|
|
|
|
|
|
|
[MaxLength(1024)] |
|
|
|
|
|
[DataType(DataType.Password)] |
|
|
|
|
|
[DisableAuditing] |
|
|
|
|
|
[Display(Name = "SmtpPassword")] |
|
|
|
|
|
public string SmtpPassword { get; set; } |
|
|
|
|
|
|
|
|
|
|
|
[MaxLength(1024)] |
|
|
|
|
|
[Display(Name = "SmtpDomain")] |
|
|
|
|
|
public string SmtpDomain { get; set; } |
|
|
|
|
|
|
|
|
|
|
|
[Display(Name = "SmtpEnableSsl")] |
|
|
|
|
|
public bool SmtpEnableSsl { get; set; } |
|
|
|
|
|
|
|
|
|
|
|
[Display(Name = "SmtpUseDefaultCredentials")] |
|
|
|
|
|
public bool SmtpUseDefaultCredentials { get; set; } |
|
|
|
|
|
|
|
|
|
|
|
[MaxLength(1024)] |
|
|
|
|
|
[Required] |
|
|
|
|
|
[Display(Name = "DefaultFromAddress")] |
|
|
|
|
|
public string DefaultFromAddress { get; set; } |
|
|
|
|
|
|
|
|
|
|
|
[MaxLength(1024)] |
|
|
|
|
|
[Required] |
|
|
|
|
|
[Display(Name = "DefaultFromDisplayName")] |
|
|
|
|
|
public string DefaultFromDisplayName { get; set; } |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|