Ejemplo n.º 1
0
        public async Task <IActionResult> Register(RegisterViewModel model, string returnUrl = null)
        {
            ViewData["ReturnUrl"] = returnUrl;
            if (ModelState.IsValid)
            {
                var result = await _userManager.CreateUser(model.Email, model.Password);

                if (result != null)
                {
                    _logger.LogInformation(3, "User created a new account with password.");
                    return(RedirectToLocal(returnUrl));
                }
                AddErrors(null);
            }

            // If we got this far, something failed, redisplay form
            return(View(model));
        }