in Application/UI/Blazor/ImageRecognition/Areas/Identity/Pages/Account/Register.cshtml.cs [48:77]
public async Task<IActionResult> OnPostAsync(string returnUrl = null)
{
returnUrl = returnUrl ?? Url.Content("~/");
if (ModelState.IsValid)
{
var user = _pool.GetUser(Input.UserName);
user.Attributes.Add(CognitoAttribute.Email.AttributeName, Input.Email);
var result = await _userManager.CreateAsync(user, Input.Password);
if (result.Succeeded)
{
_logger.LogInformation("User created a new account with password.");
// To make the registration process easy for the reInvent demo I have disabled account confirmation.
await _provider.AdminConfirmSignUpAsync(new AdminConfirmSignUpRequest
{
Username = user.Username,
UserPoolId = user.UserPool.PoolID
});
await _signInManager.PasswordSignInAsync(Input.UserName, Input.Password, false, false);
return returnUrl != null ? LocalRedirect(returnUrl) : Page();
}
foreach (var error in result.Errors) ModelState.AddModelError(string.Empty, error.Description);
}
// If we got this far, something failed, redisplay form
return Page();
}