private async Task <IActionResult> TryMergeWithExistingUserAccount( UserAccount userAccount, RegisterInputModel model) { // Merge accounts without user consent if (_applicationOptions.AutomaticAccountMerge) { await _userAccountService.AddLocalCredentialsAsync(userAccount, model.Password); if (_applicationOptions.LoginAfterAccountCreation) { await HttpContext.Authentication.SignInAsync(userAccount, null); if (model.ReturnUrl != null && _interaction.IsValidReturnUrl(model.ReturnUrl)) { return(Redirect(model.ReturnUrl)); } } else { return(await this.RedirectToSuccessAsync(userAccount, model.ReturnUrl)); } } // Ask user if he wants to merge accounts else { throw new NotImplementedException(); } // Return list of external account providers as hint var vm = new RegisterViewModel(model); vm.HintExternalAccounts = userAccount.Accounts.Select(s => s.Provider).ToArray(); return(View(vm)); }