aryehraber / statamic-captcha

Statamic Addon that protects your Statamic forms using a Captcha service.
MIT License
11 stars 8 forks source link

Option to publish view file #38

Open codedge opened 2 years ago

codedge commented 2 years ago

Would it be possible to add an option to publish the view file (where the JS code is in)?

Background is, that I need to add certain attributes to the <script .. tag in order to make it work with https://www.consentmanager.de/

Or is there any other option to modify the JS code that loads the recaptcha?

aryehraber commented 2 years ago

Hi @codedge, I guess that should be possible though I'm curious what attribute(s) you're trying to customise?

Or is there any other option to modify the JS code that loads the recaptcha?

You can choose to not use the built in {{ captcha:head }} tag and simply write your own front-end integration, then Captcha will simply do the backend validation work.

codedge commented 2 years ago

For example https://help.consentmanager.de/B%C3%BCcher/CMP/%21/Arbeiten-mit-Google-Recaptcha:

I'd like to add data-cmp-ab="1" to the <script> tag to prevent the blocking through the Consent Manager, as without Recaptcha your forms would not work anyway.

aryehraber commented 2 years ago

Thanks for the extra info, I think with customisations like that it would be best to publish the view files, as you suggested.

I'm not sure how soon I'll be able to work on this, so short-term you can simply copy-paste parts of the view file (without the @if & @endif blade directives) into your template replacing your current {{ captcha:head }} tag, then make any customisations you need.

codedge commented 2 years ago

Yeah, I thought so.

If you are open, I could also provide some publish option for the view files in an MR.

aryehraber commented 2 years ago

That'd be great, I'd be happy to review a Pull Request and merge 👍