public async Task<IActionResult> Register(RegisterViewModel model, string returnUrl = null) { ViewData["ReturnUrl"] = returnUrl; if (ModelState.IsValid) { Town initialTown = towns.GetByName("Other"); var user = new User { UserName = model.Email, Email = model.Email, Name = model.Name, Address = new Address() { Town = initialTown, Country = "Other" } }; var result = await _userManager.CreateAsync(user, model.Password); if (result.Succeeded) { _logger.LogInformation("User created a new account with password."); var code = await _userManager.GenerateEmailConfirmationTokenAsync(user); //var callbackUrl = Url.EmailConfirmationLink(user.Id, code, Request.Scheme); //await _emailSender.SendEmailConfirmationAsync(model.Email, callbackUrl); await _signInManager.SignInAsync(user, isPersistent: false); _logger.LogInformation("User created a new account with password."); this.ShowNotification(NotificationType.Success, Messages.RegistrationSuccessful); return RedirectToLocal(returnUrl); } AddErrors(result); } return View(model); }