Beispiel #1
0
        public async Task <ActionResult> RemoveLogin(string loginProvider, string providerKey)
        {
            ManageMessageId?message;
            var             result = await UserManager.RemoveLoginAsync(User.Identity.GetUserId(), new UserLoginInfo(loginProvider, providerKey));

            if (result.Succeeded)
            {
                var user = await UserManager.FindByIdAsync(User.Identity.GetUserId());

                if (user != null)
                {
                    await SignInManager.SignInAsync(user, isPersistent : false, rememberBrowser : false);
                }
                message = ManageMessageId.RemoveLoginSuccess;
            }
            else
            {
                message = ManageMessageId.Error;
            }
            return(RedirectToAction("ManageLogins", new { Message = message }));
        }