Beispiel #1
0
        private TagBuilder CreateRecaptchaDivTag()
        {
            var div = new TagBuilder("div");

            div.TagRenderMode = TagRenderMode.Normal;
            div.Attributes.Add(CssClassAttribute, "g-recaptcha");
            div.Attributes.Add(DataSiteKeyAttributeName, _service.SiteKey);
            div.Attributes.Add(DataCallBackAttributeName, RecaptchaInvisibleScriptTagHelper.GetOnSubmitFunctionName(FormId));
            div.Attributes.Add(DataSizeAttributeName, "invisible");

            return(div);
        }
Beispiel #2
0
        public override void Process(TagHelperContext context, TagHelperOutput output)
        {
            if (!_service.Enabled)
            {
                base.Process(context, output);
                return;
            }

            output.Attributes.Add(OnClickAttributeName, RecaptchaInvisibleScriptTagHelper.GetOnClickFunctionName(FormId) + "(event)");
            output.PostElement.AppendHtml(CreateRecaptchaDivTag());

            base.Process(context, output);
        }