Esempio n. 1
0
        public ActionResult RemoveExternalLogins()
        {
            ICollection <OAuthAccount> accountsFromUserName = OAuthWebSecurity.GetAccountsFromUserName(base.User.Identity.Name);
            List <GuestService.Models.ExternalLogin> model  = new List <GuestService.Models.ExternalLogin>();

            foreach (OAuthAccount account in accountsFromUserName)
            {
                AuthenticationClientData          oAuthClientData = OAuthWebSecurity.GetOAuthClientData(account.Provider);
                GuestService.Models.ExternalLogin item            = new GuestService.Models.ExternalLogin {
                    Provider            = account.Provider,
                    ProviderDisplayName = oAuthClientData.DisplayName,
                    ProviderUserId      = account.ProviderUserId
                };
                model.Add(item);
            }
            ((dynamic)base.ViewBag).ShowRemoveButton = (model.Count > 1) || OAuthWebSecurity.HasLocalAccount(WebSecurity.GetUserId(base.User.Identity.Name));
            return(this.PartialView("_RemoveExternalLoginsPartial", model));
        }
 public ActionResult RemoveExternalLogins()
 {
     ICollection<OAuthAccount> accountsFromUserName = OAuthWebSecurity.GetAccountsFromUserName(base.User.Identity.Name);
     List<GuestService.Models.ExternalLogin> model = new List<GuestService.Models.ExternalLogin>();
     foreach (OAuthAccount account in accountsFromUserName)
     {
         AuthenticationClientData oAuthClientData = OAuthWebSecurity.GetOAuthClientData(account.Provider);
         GuestService.Models.ExternalLogin item = new GuestService.Models.ExternalLogin {
             Provider = account.Provider,
             ProviderDisplayName = oAuthClientData.DisplayName,
             ProviderUserId = account.ProviderUserId
         };
         model.Add(item);
     }
     ((dynamic) base.ViewBag).ShowRemoveButton = (model.Count > 1) || OAuthWebSecurity.HasLocalAccount(WebSecurity.GetUserId(base.User.Identity.Name));
     return this.PartialView("_RemoveExternalLoginsPartial", model);
 }