How to get Typo3 plugin invisible recaptcha working for multiple domains using a condition

73 views Asked by At

Using the typo3 extension: tx_invisiblerecaptcha for including the invisiblerecaptcha in powermail. I need to overwrite the plugin config for using different keys for multiple domains. To get that I have some setup.typoscript with conditions selecting the language. The main goal is to overwrite or replace the constant the extension is looking for (need to fill that from the constant-editor). These values are: {$plugin.tx_invisiblerecaptcha.sitekey} and {$plugin.tx_invisiblerecaptcha.secretkey}

TYPO3 V10.4.* and php 7.2

So my first attempt was like this, but not working:

[siteLanguage("languageId") == "0"]
        plugin.tx_invisiblerecaptcha.sitekey = buvWAsBEn9UMs
        plugin.tx_invisiblerecaptcha.secretkey = EipHEu_h9     
[END] 
[siteLanguage("languageId") == "2"]
        plugin.tx_invisiblerecaptcha.sitekey = UqbJO80gdnv
        plugin.tx_invisiblerecaptcha.secretkey = AAAKiAmQWhUWvTopOzWl0L 
[END] 
[siteLanguage("languageId") == "3"]
        plugin.tx_invisiblerecaptcha.sitekey = mPTUT8wok0HD
        plugin.tx_invisiblerecaptcha.secretkey = AAAzEZsz9A1dUrnZHf2dU   
[END]

So I tried some other options. But still can not get the recaptcha using the keys as given in my config. How to get this working?

My other option tried not leading to success:

[siteLanguage("languageId") == “0”]
    plugin.tx_powermail.settings.setup.invisiblerecaptcha.sitekey = {$plugin.tx_invisiblerecaptcha.sitekey} >
    plugin.tx_powermail.settings.setup.invisiblerecaptcha.sitekey = Lc2GHYEn9U
    
    plugin.tx_powermail.settings.setup.spamshield.methods.11.configuration.secretkey = {$plugin.tx_invisiblerecaptcha.secretkey} >
    plugin.tx_powermail.settings.setup.spamshield.methods.11.configuration.secretkey = HYDwjWBkgLfx_NuE   
[END]
[siteLanguage("languageId") == “2”]
    other settings here for English   
[END]
[siteLanguage("languageId") == “3”]
     other settings here for German
[END]

Investigating this bit further shows some errors in the log-file. So it seems the condition is not parsed. Tried again with "traverse" in the condition. Not sure if the used syntax is as it should be. Getting an other error.. So still not working.

Tue, 03 Oct 2023 14:04:12 +0200 [ERROR] request="a5c1c5851d176" component="TYPO3.CMS.Frontend.Configuration.TypoScript.ConditionMatching.ConditionMatcher": Expression could not be parsed. - {"expression":"traverse(siteLanguage,'languageId') == '0'"}
Tue, 03 Oct 2023 14:04:12 +0200 [ERROR] request="a5c1c5851d176" component="TYPO3.CMS.Frontend.Configuration.TypoScript.ConditionMatching.ConditionMatcher": Expression could not be parsed. - {"expression":"traverse(siteLanguage,'languageId') == '2'"}
Tue, 03 Oct 2023 14:04:12 +0200 [ERROR] request="a5c1c5851d176" component="TYPO3.CMS.Frontend.Configuration.TypoScript.ConditionMatching.ConditionMatcher": Expression could not be parsed. - {"expression":"traverse(siteLanguage,'languageId') == '3'"}

The adapted condition with traverse:

[traverse(siteLanguage,'languageId') == '0']

I tried again with including the constants.txt using the first option. That still did not work. Than put that code into:

plugin.tx_invisiblerecaptcha{ ...the code}

That at least made something happen :) showing up at the constants settings and also throwing errors. But in the FE still not working. So what am I missing here?

the constant setup in the TYPO3 ObjectAnalyser

the error message

0

There are 0 answers