Beispiel #1
0
        public ActionResult RemoveExternalLogins()
        {
            var accounts = _oAuthProvider.GetOAuthAccountsFromUserName(User.Identity.Name);
            List <ExternalLogin> externalLogins = new List <ExternalLogin>();

            foreach (OAuthAccount account in accounts)
            {
                AuthenticationClientData clientData = _oAuthProvider.GetOAuthClientData(account.Provider);

                externalLogins.Add(new ExternalLogin {
                    Provider            = account.Provider,
                    ProviderDisplayName = clientData.DisplayName,
                    ProviderUserId      = account.ProviderUserId,
                });
            }

            ViewBag.ShowRemoveButton = externalLogins.Count > 1 || _membershipProvider.HasLocalAccount(User.Identity.Name);
            return(PartialView("_RemoveExternalLoginsPartial", externalLogins));
        }