コード例 #1
0
        public async Task <IActionResult> Register(RegisterViewModel model, string returnUrl = null)
        {
            ViewData["ReturnUrl"] = returnUrl;
            if (ModelState.IsValid)
            {
                IdentityResult result = await _authentication.CreateNewUserAsync(model.Email, model.Password);

                if (result.Succeeded)
                {
                    await _authentication.SignInAsync(model.Email);

                    return(RedirectToAction(nameof(AccountController.Login)));
                }
                AddErrors(result);
            }

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