Exemplo n.º 1
0
        public IUser GetUser(string ipAddress, string userId, string password)
        {
            IUser user = GetUserFromListByIpAddress(ipAddress);

            if (user == null)
            {
                if (string.IsNullOrEmpty(userId))
                {
                    user = userFactory.CreateGuestUser();
                }
                else
                {
                    user = GetUserFromuserListByUserId(userId);

                    if (user == null)
                    {
                        user = AddUserToUserList(ipAddress, userId, password);
                    }
                    else
                    {
                        if (!SetKnownUserIpAddress(userId, password, ipAddress))
                        {
                            user = userFactory.CreateFailedUser();
                        }
                    }
                }
            }

            return(user);
        }