1c028313ba
Preserve the saved SMTP password when connection settings are unchanged and keep it out of admin forms. Ref: IT-1601
51 lines
1.7 KiB
C#
51 lines
1.7 KiB
C#
using System.ComponentModel.DataAnnotations;
|
|
using HrynCo.NotificationService.DAL.Abstract.Providers;
|
|
|
|
namespace HrynCo.NotificationService.Web.Controllers.Admin.ViewModels;
|
|
|
|
public class EmailChannelEditViewModel
|
|
{
|
|
public Guid Id { get; set; }
|
|
|
|
// ── Channel fields ─────────────────────────────────────────────────
|
|
[Required]
|
|
public string ServiceName { get; set; } = "";
|
|
|
|
public int Priority { get; set; } = 1;
|
|
|
|
public EmailChannelType EmailChannelType { get; set; } = EmailChannelType.Smtp;
|
|
|
|
public int? DailyLimit { get; set; }
|
|
|
|
public int? MonthlyLimit { get; set; }
|
|
|
|
[Range(1, 100)]
|
|
public int WarnThresholdPercent { get; set; } = 90;
|
|
|
|
public bool IsActive { get; set; } = true;
|
|
|
|
// ── SMTP Settings ──────────────────────────────────────────────────
|
|
[Required]
|
|
public string Host { get; set; } = "";
|
|
|
|
[Range(1, 65535)]
|
|
public int Port { get; set; } = 587;
|
|
|
|
[Required]
|
|
public string Username { get; set; } = "";
|
|
|
|
public string? Password { get; set; }
|
|
|
|
public bool UseSsl { get; set; } = true;
|
|
|
|
[Required, EmailAddress]
|
|
public string FromEmail { get; set; } = "";
|
|
|
|
[Required]
|
|
public string FromName { get; set; } = "";
|
|
|
|
// ── Computed ───────────────────────────────────────────────────────
|
|
public bool IsNew => Id == Guid.Empty;
|
|
public string PageTitle => IsNew ? "Create Channel" : "Edit Channel";
|
|
}
|