Example #1
0
        public static LoginUserStatus ValidateUser(HiMembershipUser user)
        {
            LoginUserStatus result;

            if (user == null)
            {
                result = LoginUserStatus.UnknownError;
            }
            else
            {
                if (!user.IsApproved)
                {
                    result = LoginUserStatus.AccountPending;
                }
                else
                {
                    if (user.IsLockedOut)
                    {
                        result = LoginUserStatus.AccountLockedOut;
                    }
                    else
                    {
                        if (!HiMembership.ValidateUser(user.Username, user.Password))
                        {
                            result = LoginUserStatus.InvalidCredentials;
                        }
                        else
                        {
                            result = LoginUserStatus.Success;
                        }
                    }
                }
            }
            return(result);
        }
Example #2
0
        public static CreateUserStatus Create(HiMembershipUser userToCreate, string passwordQuestion, string passwordAnswer, string[] roles)
        {
            CreateUserStatus result;

            if (userToCreate == null)
            {
                result = CreateUserStatus.UnknownFailure;
            }
            else
            {
                MemberUserProvider memberUserProvider = MemberUserProvider.Instance();
                try
                {
                    CreateUserStatus createUserStatus = memberUserProvider.CreateMembershipUser(userToCreate, passwordQuestion, passwordAnswer);
                    if (createUserStatus == CreateUserStatus.Created)
                    {
                        Roles.AddUserToRoles(userToCreate.Username, roles);
                    }
                }
                catch (CreateUserException ex)
                {
                    result = ex.CreateUserStatus;
                    return(result);
                }
                result = CreateUserStatus.Created;
            }
            return(result);
        }
Example #3
0
 public AnonymousUser(HiMembershipUser membershipUser)
 {
     if (!membershipUser.IsAnonymous || membershipUser.UserRole != UserRole.Anonymous || membershipUser.Username != "Anonymous")
     {
         throw new Exception("Invalid AnonymousUser");
     }
     this.MembershipUser = membershipUser;
 }
Example #4
0
        public static bool UpdateUser(HiMembershipUser user)
        {
            bool result;

            if (user == null)
            {
                result = false;
            }
            else
            {
                MemberUserProvider memberUserProvider = MemberUserProvider.Instance();
                result = memberUserProvider.UpdateMembershipUser(user);
            }
            return(result);
        }
Example #5
0
 public abstract bool UpdateMembershipUser(HiMembershipUser user);
Example #6
0
 public abstract CreateUserStatus CreateMembershipUser(HiMembershipUser userToCreate, string passwordQuestion, string passwordAnswer);
Example #7
0
 public static CreateUserStatus Create(HiMembershipUser userToCreate, string[] roles)
 {
     return(UserHelper.Create(userToCreate, null, null, roles));
 }