Пример #1
0
        /// <summary>
        /// Called by the framework so the component can add component specific client-side configuration options and localizations to the page.
        /// </summary>
        /// <param name="manager">The YetaWF.Core.Support.Manager instance of current HTTP request.</param>
        public async Task AddSupportAsync(YetaWFManager manager)
        {
            RecaptchaV2Config config = await RecaptchaV2Config.LoadRecaptchaV2ConfigAsync();

            if (string.IsNullOrWhiteSpace(config.PublicKey))
            {
                throw new InternalError("The Recaptcha configuration settings are missing - no public key found");
            }

            ScriptManager scripts = manager.ScriptManager;
            string        area    = AreaRegistration.CurrentPackage.AreaName;

            scripts.AddConfigOption(area, "SiteKey", config.PublicKey);
            scripts.AddConfigOption(area, "Theme", config.GetTheme());
            scripts.AddConfigOption(area, "Size", config.GetSize());
        }