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

            if (user == null)
            {
                return(false);
            }
            if (user.IsLocal)
            {
                return(_userStore.DeleteOAuthAccount(provider, providerUserId));
            }
            var accounts = _userStore.GetOAuthAccountsForUser(user.Username);

            if (accounts.Count() > 1)
            {
                return(_userStore.DeleteOAuthAccount(provider, providerUserId));
            }
            return(false);
        }
Beispiel #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);
        }
Beispiel #3
0
 public bool DissassociateOAuthAccount(string provider, string providerUserId)
 {
     return(_userStore.DeleteOAuthAccount(provider, providerUserId));
 }