public async Task <ActionResult> RestorePassword(LoginModel model) { var user = await AppFactory.AttendeeService.Value.GetAttendeeByEmailAsync(model.Email); if (user != null) { var token = new QuickAuthToken { Email = user.EMail, Token = Guid.NewGuid().ToString("N") }; var notification = new RestorePasswordMessage { Email = user.EMail, FullName = user.FullName, Token = token.Token }; await Task.WhenAll( AppFactory.QuickAuthTokenService.Value.AddQuickAuthTokenAsync(token), NotificationFactory.AttendeeNotificationService.Value.SendRestorePasswordEmailAsync(notification) ); } return(View()); }
public async Task SendRestorePasswordEmailAsync(RestorePasswordMessage model) { var template = new RestorePassword(); template.ConfirmationCode = model.Token; var text = template.TransformText(); var message = new SendGridMessage(); message.To = new[] { new MailAddress(model.Email, model.FullName) }; message.Subject = string.Format("Восстановление пароля на AZUREday {0}", Configuration.Year); message.Html = text; message.From = new MailAddress(Configuration.SendGridFromEmail, Configuration.SendGridFromName); message.ReplyTo = new[] { new MailAddress(Configuration.SendGridFromEmail, Configuration.SendGridFromName) }; await SendEmail(message); }
public async Task SendRestorePasswordEmailAsync(RestorePasswordMessage model) { var template = new RestorePassword(); template.ConfirmationCode = model.Token; var text = template.TransformText(); var message = new SendGridMessage(); message.To = new[] { new MailAddress(model.Email, model.FullName) }; message.Subject = $"Восстановление пароля на AZUREday {Configuration.Year}"; message.Html = text; message.From = new MailAddress(Configuration.SendGridFromEmail, Configuration.SendGridFromName); message.ReplyTo = new[] { new MailAddress(Configuration.SendGridFromEmail, Configuration.SendGridFromName) }; await SendEmail(message); }
public async Task<ActionResult> RestorePassword(LoginModel model) { var user = await AppFactory.AttendeeService.Value.GetAttendeeByEmailAsync(model.Email); if (user != null) { var token = new QuickAuthToken { Email = user.EMail, Token = Guid.NewGuid().ToString("N") }; var notification = new RestorePasswordMessage { Email = user.EMail, FullName = user.FullName, Token = token.Token }; await Task.WhenAll( AppFactory.QuickAuthTokenService.Value.AddQuickAuthTokenAsync(token), NotificationFactory.AttendeeNotificationService.Value.SendRestorePasswordEmailAsync(notification) ); } return View(); }