public SendAsync ( string tenant ) : System.Threading.Tasks.Task | ||
tenant | string | |
Результат | System.Threading.Tasks.Task |
public async Task SendAsync(string tenant)
{
string template = this.GetTemplate(tenant);
string parsed = this.ParseTemplate(this._context, template);
string subject = "Confirm Your Registration at " + this._context.Request.Url.Authority;
var processor = EmailProcessor.GetDefault(tenant);
if (processor != null)
{
var email = this.GetEmail(processor, this._registration, subject, parsed);
var queue = new MailQueueManager(tenant, email);
await queue.AddAsync().ConfigureAwait(false);
await queue.ProcessMailQueueAsync(processor).ConfigureAwait(false);
}
}
}
public static async Task<bool> SignUpAsync(HttpContextBase context, string tenant, Registration model, RemoteUser user) { if (model.Password != model.ConfirmPassword) { throw new PasswordConfirmException("Passwords do not match."); } if (model.Email != model.ConfirmEmail) { throw new PasswordConfirmException("Emails do not match."); } model.Browser = user.Browser; model.IpAddress = user.IpAddress; var registration = model.Adapt<DTO.Registration>(); registration.Password = PasswordManager.GetHashedPassword(model.Password); string registrationId = (await Registrations.RegisterAsync(tenant, registration).ConfigureAwait(false)).ToString(); if (string.IsNullOrWhiteSpace(registrationId)) { return false; } var email = new SignUpEmail(context, registration, registrationId); await email.SendAsync(tenant).ConfigureAwait(false); return true; }