// // POST: /Account/SendLogInLink public IActionResult SendLogInLink(SendLogInLinkModel model) { if (ModelState.IsValid) { model.Send(Url); this.SetResultMessage($"A log in link will be sent to {model.Email}."); } return(RedirectToAction("Index", "Home")); }
public IActionResult Index() { if (User?.Identity?.IsAuthenticated == true) { return(RedirectToAction("Dashboard", "Home")); } var model = new SendLogInLinkModel(); return(View(model)); }
public async Task <IActionResult> SendLogInLink(SendLogInLinkModel model, CancellationToken token = default) { if (ModelState.IsValid) { var accounts = await _accountRepository.GetAllAsync(token); var account = accounts.SingleOrDefault(a => a.Email?.Equals(model.Email, StringComparison.OrdinalIgnoreCase) ?? false); if (account is null && _appSettings.AdminEmail.Equals(model.Email, StringComparison.OrdinalIgnoreCase)) { account = await CreateAdminUser(token); } await SendLogInEmail(account, token); } this.SetResultMessage($"A log in link will be sent to {model.Email}."); return(RedirectToAction("Index", "Home")); }