Пример #1
0
        public async Task <ActionResult> Complete([Bind(Include = "Id,Name,Email,Password,ConfirmPassword")] InvitedUserRegisterViewModel user)
        {
            if (!ModelState.IsValid)
            {
                return(View(user));
            }
            var result = await UserManager.RegisterInvitedUser(user.Id, user.Email, user.Password);

            if (result.Succeeded)
            {
                return(RedirectToAction("Login", "Account"));
            }
            else
            {
                AddErrors(result);
                return(View(user));
            }
        }
Пример #2
0
        public async Task <ActionResult> Complete(string userId, string code)
        {
            var result = await UserManager.ConfirmEmailAsync(userId, code);

            if (result.Succeeded)
            {
                var storedUser = await UserManager.FindByIdAsync(userId);

                var user = new InvitedUserRegisterViewModel
                {
                    Id    = storedUser.Id,
                    Email = storedUser.Email,
                    Name  = storedUser.Name
                };
                return(View(user));
            }
            else
            {
                return(View("InvitationError"));
            }
        }