Skip to content

Commit 59ae5fc

Browse files
fix: correct file coding
1 parent ffa619f commit 59ae5fc

File tree

7 files changed

+90
-87
lines changed

7 files changed

+90
-87
lines changed

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Contao Cloudflare Turnstile Bundle
22

3-
This Contao module overrides the default security questions/captcha form field with [Cloudflare Turnstile](https://www.cloudflare.com/application-services/products/turnstile/).
3+
This Contao module overrides the default security questions/captcha form field
4+
with [Cloudflare Turnstile](https://www.cloudflare.com/application-services/products/turnstile/).
45

56
## Requirements
67

@@ -17,7 +18,8 @@ $ composer require guave/cloudflareturnstile-bundle
1718

1819
There are two ways to add the configuration needed:
1920

20-
a) Go to Settings in the Contao Backend and add your Turnstile Site Key and Secret Key under "Security: Cloudflare Turnstile"
21+
a) Go to Settings in the Contao Backend and add your Turnstile Site Key and Secret Key under "Security: Cloudflare
22+
Turnstile"
2123

2224
or
2325

composer.json

Lines changed: 70 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,73 @@
11
{
2-
"name": "guave/cloudflareturnstile-bundle",
3-
"description": "Cloudflare Turnstile for Contao",
4-
"license": "ISC",
5-
"type": "contao-bundle",
6-
"homepage": "https://www.guaveinteractive.ch",
7-
"support": {
8-
"issues": "https://github.com/guavestudios/cloudflareturnstilebundle/issues",
9-
"source": "https://github.com/guavestudios/cloudflareturnstilebundle"
10-
},
11-
"require": {
12-
"php": "^7.4 || ^8.0",
2+
"name": "guave/cloudflareturnstile-bundle",
3+
"description": "Cloudflare Turnstile for Contao",
4+
"license": "ISC",
5+
"type": "contao-bundle",
6+
"homepage": "https://www.guaveinteractive.ch",
7+
"support": {
8+
"issues": "https://github.com/guavestudios/cloudflareturnstilebundle/issues",
9+
"source": "https://github.com/guavestudios/cloudflareturnstilebundle"
10+
},
11+
"require": {
12+
"php": "^7.4 || ^8.0",
1313
"ext-curl": "*",
14-
"contao/core-bundle": "^4.13",
15-
"symfony/config": "^5.4",
16-
"symfony/dependency-injection": "^5.4",
17-
"symfony/http-kernel": "^5.4"
18-
},
19-
"require-dev": {
20-
"bamarni/composer-bin-plugin": "^1.5",
21-
"contao/manager-plugin": "^2.0",
22-
"phpunit/phpunit": "^9.5",
23-
"roave/security-advisories": "dev-latest",
24-
"symfony/phpunit-bridge": "^6.1"
25-
},
26-
"conflict": {
27-
"contao/manager-plugin": "<2.0 || >=3.0"
28-
},
29-
"autoload": {
30-
"psr-4": {
31-
"Guave\\CloudflareTurnstileBundle\\": "src/"
32-
},
33-
"classmap": [
34-
"contao/"
35-
],
36-
"exclude-from-classmap": [
37-
"contao/config/",
38-
"contao/dca/",
39-
"contao/languages/",
40-
"contao/templates/"
41-
]
42-
},
43-
"autoload-dev": {
44-
"psr-4": {
45-
"Guave\\CloudflareTurnstileBundle\\Tests\\": "tests/"
46-
}
47-
},
48-
"config": {
49-
"allow-plugins": {
50-
"bamarni/composer-bin-plugin": true,
51-
"contao-components/installer": true,
52-
"contao/manager-plugin": true,
53-
"php-http/discovery": false
54-
}
55-
},
56-
"extra": {
57-
"bamarni-bin": {
58-
"bin-links": false,
59-
"target-directory": "tools"
60-
},
61-
"contao-manager-plugin": "Guave\\CloudflareTurnstileBundle\\ContaoManager\\Plugin"
62-
},
63-
"scripts": {
64-
"all": [
65-
"@unit-tests",
66-
"@ecs",
67-
"@phpstan"
68-
],
69-
"ecs": "@php tools/ecs/vendor/bin/ecs check src tests --config ecs.php --fix --ansi",
70-
"phpstan": "@php tools/phpstan/vendor/bin/phpstan analyze --ansi",
71-
"unit-tests": "@php vendor/bin/phpunit --colors=always"
72-
}
14+
"contao/core-bundle": "^4.13",
15+
"symfony/config": "^5.4",
16+
"symfony/dependency-injection": "^5.4",
17+
"symfony/http-kernel": "^5.4"
18+
},
19+
"require-dev": {
20+
"bamarni/composer-bin-plugin": "^1.5",
21+
"contao/manager-plugin": "^2.0",
22+
"phpunit/phpunit": "^9.5",
23+
"roave/security-advisories": "dev-latest",
24+
"symfony/phpunit-bridge": "^6.1"
25+
},
26+
"conflict": {
27+
"contao/manager-plugin": "<2.0 || >=3.0"
28+
},
29+
"autoload": {
30+
"psr-4": {
31+
"Guave\\CloudflareTurnstileBundle\\": "src/"
32+
},
33+
"classmap": [
34+
"contao/"
35+
],
36+
"exclude-from-classmap": [
37+
"contao/config/",
38+
"contao/dca/",
39+
"contao/languages/",
40+
"contao/templates/"
41+
]
42+
},
43+
"autoload-dev": {
44+
"psr-4": {
45+
"Guave\\CloudflareTurnstileBundle\\Tests\\": "tests/"
46+
}
47+
},
48+
"config": {
49+
"allow-plugins": {
50+
"bamarni/composer-bin-plugin": true,
51+
"contao-components/installer": true,
52+
"contao/manager-plugin": true,
53+
"php-http/discovery": false
54+
}
55+
},
56+
"extra": {
57+
"bamarni-bin": {
58+
"bin-links": false,
59+
"target-directory": "tools"
60+
},
61+
"contao-manager-plugin": "Guave\\CloudflareTurnstileBundle\\ContaoManager\\Plugin"
62+
},
63+
"scripts": {
64+
"all": [
65+
"@unit-tests",
66+
"@ecs",
67+
"@phpstan"
68+
],
69+
"ecs": "@php tools/ecs/vendor/bin/ecs check src tests --config ecs.php --fix --ansi",
70+
"phpstan": "@php tools/phpstan/vendor/bin/phpstan analyze --ansi",
71+
"unit-tests": "@php vendor/bin/phpunit --colors=always"
72+
}
7373
}

contao/languages/en/tl_form_field.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22

33
$GLOBALS['TL_LANG']['tl_form_field']['turnstileAction'] = [
44
'Turnstile action',
5-
"Will use the form's alias as a default if not overridden here"
5+
"Will use the form's alias as a default if not overridden here",
66
];

contao/languages/en/tl_settings.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44

55
$GLOBALS['TL_LANG']['tl_settings']['turnstilePublicKey'] = [
66
'Site key',
7-
"The key that's getting served to your users."
7+
"The key that's getting served to your users.",
88
];
99
$GLOBALS['TL_LANG']['tl_settings']['turnstilePrivateKey'] = [
1010
'Secret key',
11-
"The key that's used for communication between Contao and Cloudflare."
11+
"The key that's used for communication between Contao and Cloudflare.",
1212
];

contao/templates/form_turnstile.html5

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,26 +8,26 @@
88
<div class="cf-turnstile"
99
id="turnstile-<?= $this->strCaptchaKey ?>"
1010
data-sitekey="<?= $this->publicKey ?>"
11-
data-callback="onSubmit_<?= $this->strCaptchaKey ?>"
12-
></div>
11+
data-callback="onSubmit_<?= $this->strCaptchaKey ?>">
12+
</div>
1313

1414
<script src="https://challenges.cloudflare.com/turnstile/v0/api.js?onload=onloadTurnstileCallbackField<?= $this->strCaptchaKey ?>" defer async></script>
1515
<script>
1616
function onloadTurnstileCallbackField<?= $this->strCaptchaKey ?> () {
17-
window.onSubmit_<?= $this->strCaptchaKey ?> = function () { };
17+
window.onSubmit_<?= $this->strCaptchaKey ?> = function () { }
1818

1919
turnstile
20-
.execute('<?= $this->publicKey ?>', {action: '<?= $this->turnstileAction ?>'})
20+
.execute('<?= $this->publicKey ?>', { action: '<?= $this->turnstileAction ?>' })
2121
.then(function (token) {
22-
var node = document.getElementById('turnstile-<?= $this->strCaptchaKey ?>');
22+
var node = document.getElementById('turnstile-<?= $this->strCaptchaKey ?>')
2323

24-
var input = document.createElement('input');
25-
input.setAttribute('type', 'hidden');
26-
input.setAttribute('name', 'cf-turnstile-response');
27-
input.setAttribute('value', token);
24+
var input = document.createElement('input')
25+
input.setAttribute('type', 'hidden')
26+
input.setAttribute('name', 'cf-turnstile-response')
27+
input.setAttribute('value', token)
2828

29-
node.parentNode.replaceChild(input, node);
30-
});
29+
node.parentNode.replaceChild(input, node)
30+
})
3131
}
3232
</script>
3333
<?php $this->endblock(); ?>

ecs.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
use Symplify\EasyCodingStandard\Config\ECSConfig;
1010

1111
return static function (ECSConfig $ecsConfig): void {
12-
$ecsConfig->sets([__DIR__ . '/tools/ecs/vendor/contao/easy-coding-standard/config/contao.php']);
12+
$ecsConfig->sets([__DIR__.'/tools/ecs/vendor/contao/easy-coding-standard/config/contao.php']);
1313
$ecsConfig->ruleWithConfiguration(GlobalNamespaceImportFixer::class, [
1414
'import_classes' => true,
1515
'import_constants' => false,

src/Form/FormTurnstile.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ public function validate(): void
4040
{
4141
if ($this->useFallback()) {
4242
parent::validate();
43+
4344
return;
4445
}
4546

0 commit comments

Comments
 (0)