public async Task <IActionResult> OnPostAsync(string returnUrl = null) { returnUrl = returnUrl ?? Url.Content("~/"); ExternalLogins = (await _signInManager.GetExternalAuthenticationSchemesAsync()).ToList(); if (ModelState.IsValid) { var user = new BlogAppUser { UserName = Input.UserName, EmailConfirmed = true }; var result = await _userManager.CreateAsync(user, Input.Password); if (result.Succeeded) { _logger.LogInformation("Nowe konto zostało założone."); return(RedirectToAction("Index", "Home")); } foreach (var error in result.Errors) { ModelState.AddModelError(string.Empty, error.Description); } } // If we got this far, something failed, redisplay form return(Page()); }
private async Task LoadAsync(BlogAppUser user) { var userName = await _userManager.GetUserNameAsync(user); Username = userName; }