示例#1
0
        public StatusResponse GetStatus()
        {
            var status = _allowedIpService.GetStatus();

            return(new StatusResponse()
            {
                Enabled = status.Enabled
            });
        }
示例#2
0
        public bool TryFindContent(PublishedRequest request)
        {
            var status = _allowedIpService.GetStatus();

            if (!status.Enabled)
            {
                return(false);
            }

            var ip   = request.UmbracoContext.HttpContext.Request.UserHostAddress;
            var item = _allowedIpService.GetByIpAddress(ip);

            if (item == null)
            {
                request.SetRedirect("/ip-not-allowed");

                return(true);
            }

            return(false);
        }