示例#1
0
        internal async Task <IActionResult> TryCreateNewUserAccount(
            UserAccount userAccount,
            RegisterInputModel model)
        {
            userAccount = await userAccountService.CreateNewLocalUserAccountAsync(
                model.Email, model.Password, model.ReturnUrl);

            // Send confirmation mail
            if (applicationOptions.RequireLocalAccountVerification)
            {
                await SendEmailAsync(userAccount);
            }

            if (applicationOptions.LoginAfterAccountCreation)
            {
                await httpContextAccessor.HttpContext.SignInAsync(userAccount, null);

                if (model.ReturnUrl != null && interaction.IsValidReturnUrl(model.ReturnUrl))
                {
                    return(Redirect(model.ReturnUrl));
                }
            }

            return(View("Success", CreateSuccessViewModel(userAccount, model.ReturnUrl)));
        }
        private async Task <IActionResult> TryCreateNewUserAccount(
            UserAccount userAccount,
            RegisterInputModel model)
        {
            userAccount = await _userAccountService.CreateNewLocalUserAccountAsync(
                model.Email, model.Password, model.ReturnUrl);

            // Send confirmation mail
            if (_applicationOptions.RequireLocalAccountVerification)
            {
                await SendUserAccountCreatedAsync(userAccount);
            }

            if (_applicationOptions.LoginAfterAccountCreation)
            {
                await HttpContext.Authentication.SignInAsync(userAccount, null);

                if (model.ReturnUrl != null && _interaction.IsValidReturnUrl(model.ReturnUrl))
                {
                    return(Redirect(model.ReturnUrl));
                }
            }

            return(await this.RedirectToSuccessAsync(userAccount, model.ReturnUrl));
        }