diff --git a/src/EPiServer.Forms.Samples/Implementation/Elements/HcaptchaElementBlock.cs b/src/EPiServer.Forms.Samples/Implementation/Elements/HcaptchaElementBlock.cs index 3ee6c10..d2083f7 100644 --- a/src/EPiServer.Forms.Samples/Implementation/Elements/HcaptchaElementBlock.cs +++ b/src/EPiServer.Forms.Samples/Implementation/Elements/HcaptchaElementBlock.cs @@ -169,13 +169,28 @@ public override string EditViewFriendlyTitle } } + /// + /// Custom script URL for use in certain scenarios, like mainland China. See more here: https://docs.hcaptcha.com/faq/#does-hcaptcha-support-access-by-users-in-china. + /// Will use the default URL if not set. + /// + [Display(GroupName = SystemTabNames.Settings, Order = -3300)] + public virtual string ClientScriptUrl { get; set; } + + private const string DEFAULT_CLIENT_SCRIPT_URL = "https://js.hcaptcha.com/1/api.js"; + public IEnumerable> GetExtraResources() { return new List>() { new Tuple( - "script", string.Format("https://js.hcaptcha.com/1/api.js") + "script", !string.IsNullOrEmpty(ClientScriptUrl) ? ClientScriptUrl : DEFAULT_CLIENT_SCRIPT_URL ) }; } + + public override void SetDefaultValues(ContentType contentType) + { + base.SetDefaultValues(contentType); + ClientScriptUrl = DEFAULT_CLIENT_SCRIPT_URL; + } } -} \ No newline at end of file +}