public async Task CreateAccountAsync(AccountItemViewModel account) { _sharedService.WriteLogs("CreateAccountAsync started by:" + _userSettings.UserName, true); try { if (!string.IsNullOrEmpty(account.Email)) { if (!ValidateExtension.IsEmailValid(account.Email)) { _sharedService.WriteLogs("Email: " + account.Email + " is invalid.", false); return; } } var user = new EDIApplicationUser { UserName = account.Email, Email = account.Email, PhoneNumber = account.PhoneNumber, FirstName = account.FirstName, LastName = account.LastName, CountryID = account.CountryID, ProvinceID = account.ProvinceID }; var result = await _userManager.CreateAsync(user); if (!string.IsNullOrEmpty(account.RoleID)) { var role = await _accountRepository.GetRoleByIdAsync(account.RoleID); await _userManager.AddToRoleAsync(user, role.Name); } if (result.Succeeded) { var code = await _userManager.GenerateEmailConfirmationTokenAsync(user); //var callbackUrl = _urlHelper.EmailConfirmationLink(user.Id, code, account.Scheme); var callbackUrl = @"htts://fanout.phri.ca"; await _emailSender.SendEmailConfirmationAsync(account.Email, callbackUrl, user.FirstName); _logger.LogInformation("User created a new account with password."); } } catch (Exception ex) { _sharedService.WriteLogs("CreateAccount failed:" + ex.Message, false); } }