From 171897c9126bb8e9a08d2e3436cfe6fc000209aa Mon Sep 17 00:00:00 2001 From: SLINIcraftet204 Date: Wed, 23 Oct 2024 08:52:57 +0200 Subject: [PATCH] Tested some stuff in the melv-turnstile.js --- .../administration/js/melv-turnstile.js | 41 +++++++++++-------- 1 file changed, 25 insertions(+), 16 deletions(-) diff --git a/src/Resources/public/administration/js/melv-turnstile.js b/src/Resources/public/administration/js/melv-turnstile.js index b6cded8..3c1b9b0 100644 --- a/src/Resources/public/administration/js/melv-turnstile.js +++ b/src/Resources/public/administration/js/melv-turnstile.js @@ -59,30 +59,39 @@ i = s.Component, c = s.Locale; c.extend("en-GB", l), c.extend("de-DE", r), i.override("sw-settings-captcha-select-v2", { - template: `\n{% block sw_settings_captcha_select_v2_google_recaptcha_v2 %}\n {% parent() %}\n {% block sw_settings_captcha_select_v2_cloudflare_turnstile %}\n \n\n \n {% block sw_settings_captcha_select_v2_cloudflare_turnstile_description %}\n

\n {{ $tc(\'sw-settings-basic-information.captcha.label.cloudFlareTurnstileDescription\') }}\n

\n {% endblock %}\n\n \n {% block sw_settings_captcha_select_v2_cloudflare_turnstile_site_key %}\n \n {% endblock %}\n\n \n {% block sw_settings_captcha_select_v2_cloudflare_turnstile_secret_key %}\n \n {% endblock %}\n \n {% endblock %}\n{% endblock %}`, + template: `\n{% block sw_settings_captcha_select_v2_google_recaptcha_v2 %}\n {% parent() %}\n {% block sw_settings_captcha_select_v2_cloudflare_turnstile %}\n \n\n \n {% block sw_settings_captcha_select_v2_cloudflare_turnstile_description %}\n

\n {{ $tc(\'sw-settings-basic-information.captcha.label.cloudFlareTurnstileDescription\') }}\n

\n {% endblock %}\n\n \n {% block sw_settings_captcha_select_v2_cloudflare_turnstile_site_key %}\n \n {% endblock %}\n\n \n {% block sw_settings_captcha_select_v2_cloudflare_turnstile_secret_key %}\n \n {% endblock %}\n \n {% endblock %}\n{% endblock %}`, mounted() { - if (!this.currentValue.cloudFlareTurnstile) { - this.currentValue.cloudFlareTurnstile = { - isActive: false, - config: { + // Warte, bis die Daten verfügbar sind + this.$nextTick(() => { + if (!this.currentValue.cloudFlareTurnstile) { + this.currentValue.cloudFlareTurnstile = { + isActive: false, + config: { + siteKey: '', + secretKey: '' + } + }; + } else if (!this.currentValue.cloudFlareTurnstile.config) { + this.currentValue.cloudFlareTurnstile.config = { siteKey: '', secretKey: '' - } - }; - } - console.log('currentValue.cloudFlareTurnstile:', this.currentValue.cloudFlareTurnstile); + }; + } + + console.log('Mounted - Initial cloudFlareTurnstile:', JSON.stringify(this.currentValue.cloudFlareTurnstile.config)); + }); }, methods: { - // Test handler - handleInput(event) { - console.log('input triggered:', event); - }, - updateCaptchaConfig() { - this.$emit('input', this.currentValue.cloudFlareTurnstile.config); - console.log('Updated Captcha Config:', this.currentValue.cloudFlareTurnstile.config); + console.log('Before updating - SiteKey:', this.currentValue.cloudFlareTurnstile.config.siteKey); + console.log('Before updating - SecretKey:', this.currentValue.cloudFlareTurnstile.config.secretKey); + + this.$set(this.currentValue.cloudFlareTurnstile.config, 'siteKey', this.currentValue.cloudFlareTurnstile.config.siteKey); + this.$set(this.currentValue.cloudFlareTurnstile.config, 'secretKey', this.currentValue.cloudFlareTurnstile.config.secretKey); + + console.log('Updated Captcha Config:', JSON.stringify(this.currentValue.cloudFlareTurnstile.config)); } } });