public bool DissassociateOAuthAccount(string provider, string providerUserId)
        {
            var user = _userStore.GetUserByOAuthProvider(provider, providerUserId);

            if (user == null)
            {
                return(false);
            }
            var accounts = _userStore.GetOAuthAccountsForUser(user.Username);

            if (accounts.Count() > 1)
            {
                return(_userStore.DeleteOAuthAccount(provider, providerUserId));
            }
            return(false);
        }
Ejemplo n.º 2
0
        /// <summary>
        ///   Dissassociates the OAuth account for a userid.
        /// </summary>
        /// <param name="provider"> The provider. </param>
        /// <param name="providerUserId"> The provider user id. </param>
        /// <returns> </returns>
        public bool DisassociateOAuthAccount(string provider, string providerUserId)
        {
            IFlexMembershipUser user = _userStore.GetUserByOAuthProvider(provider, providerUserId);

            if (user == null)
            {
                return(false);
            }
            IEnumerable <OAuthAccount> accounts = _userStore.GetOAuthAccountsForUser(user.Username);

            if (HasLocalAccount(user.Username))
            {
                return(_userStore.DeleteOAuthAccount(provider, providerUserId));
            }

            if (accounts.Count() > 1)
            {
                return(_userStore.DeleteOAuthAccount(provider, providerUserId));
            }

            return(false);
        }
Ejemplo n.º 3
0
 public IEnumerable <OAuthAccount> GetOAuthAccountsFromUserName(string username)
 {
     return(_userStore.GetOAuthAccountsForUser(username));
 }