using Microsoft.Extensions.Options; using System.Threading.Tasks; namespace Web2FA.Services { // This class is used by the application to send Email and SMS // when you turn on two-factor authentication in ASP.NET Identity. // For more details see this link https://go.microsoft.com/fwlink/?LinkID=532713 public class AuthMessageSender : IEmailSender, ISmsSender { public AuthMessageSender(IOptions optionsAccessor) { Options = optionsAccessor.Value; } public SMSoptions Options { get; } // set only via Secret Manager public Task SendEmailAsync(string email, string subject, string message) { // Plug in your email service here to send an email. return Task.FromResult(0); } public Task SendSmsAsync(string number, string message) { ASPSMS.SMS SMSSender = new ASPSMS.SMS(); SMSSender.Userkey = Options.SMSAccountIdentification; SMSSender.Password = Options.SMSAccountPassword; SMSSender.Originator = Options.SMSAccountFrom; SMSSender.AddRecipient(number); SMSSender.MessageData = message; SMSSender.SendTextSMS(); return Task.FromResult(0); } } }