public static MvcHtmlString HoneypotField(this HtmlHelper html)
        {
            var token           = Honeypot.CreateToken();
            var serializedToken = Honeypot.SerializeToken(token);

            var textField   = html.TextBox(token.Name, string.Empty, new { @class = "required-text-input", autocomplete = "off" }).ToHtmlString();
            var hiddenField = html.Hidden(Honeypot.TokenFieldName, serializedToken).ToHtmlString();

            return(MvcHtmlString.Create(textField + hiddenField));
        }
        public void OnAuthorization(AuthorizationContext filterContext)
        {
            if (!SecuritySettings.EnableHoneypotProtection)
            {
                return;
            }

            var isBot = Honeypot.IsBot(filterContext.HttpContext);

            if (!isBot)
            {
                return;
            }

            Logger.Warn("Honeypot detected a bot and rejected the request.");

            var redirectUrl = WebHelper.Value.GetThisPageUrl(true);

            filterContext.Result = new RedirectResult(redirectUrl);
        }