Compare commits
10 Commits
Author | SHA1 | Date | |
---|---|---|---|
949ea78c02 | |||
86dd130ac6 | |||
![]() |
c49edec9a8 | ||
![]() |
ed5865f2f5 | ||
171897c912 | |||
02a1378da1 | |||
0e541b9170 | |||
9f6779051c | |||
b369cfec03 | |||
5957b5586f |
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
composer.phar/
|
||||
/composer.phar
|
||||
.idea
|
||||
|
27
README.md
27
README.md
@ -1,10 +1,11 @@
|
||||
## A plugin for [Shopware 6](https://github.com/shopware/platform)
|
||||
## A plugin for [Shopware 6.6.X](https://github.com/shopware/platform)
|
||||
|
||||
**Proof-of-concept**: Integrates CloudFlare Turnstile with Shopware 6.
|
||||
**Selfcoded and updated Version of MelvTurnstile**: Integrates CloudFlare Turnstile in Shopware with the Core Version 6.6.X.
|
||||
|
||||
Create a free account to claim your keys: https://www.cloudflare.com/en-gb/lp/turnstile/
|
||||
Create a free account or login to CloudFlare to generate your Sitekeys:
|
||||
[CloudFlare Turnstile](https://www.cloudflare.com/products/turnstile/)
|
||||
|
||||
**Config:**
|
||||
**Config:**
|
||||

|
||||
|
||||
**Front-end:**
|
||||
@ -12,19 +13,17 @@ Create a free account to claim your keys: https://www.cloudflare.com/en-gb/lp/tu
|
||||
|
||||
Known issues:
|
||||
* Not working when form in modal
|
||||
* No alert when captcha invalid
|
||||
* No alert when captcha timed out
|
||||
* Current captcha settings are overridden when installing plugin
|
||||
* Missing translations for German
|
||||
* ..
|
||||
* _to be continued..._
|
||||
|
||||
## Requirements
|
||||
|
||||
| Version | Requirements |
|
||||
|------------|---------------------------- |
|
||||
| 0.1.0 | Shopware 6.4 >= |
|
||||
| Version | Requirements |
|
||||
|------------------------------------------------------------------------|---------------------------- |
|
||||
|[0.1.0](https://github.com/SLINIcraftet204/MelvTurnstile/releases) | Shopware 6.4 >= |
|
||||
| 0.2.0 (coming soon) | Shopware 6.6 >= |
|
||||
|
||||
## License
|
||||
## Logo
|
||||
|
||||
Plugin's Icon by [flaticon](https://www.flaticon.com).
|
||||
|
||||
The plugin is released under MIT. For a full overview check the [LICENSE](./LICENSE) file.
|
||||
Logo by [Seeklogo.com](https://seeklogo.com/vector-logo/453922/cloudflare-turnstile)
|
||||
|
@ -7,10 +7,13 @@
|
||||
"authors": [
|
||||
{
|
||||
"name": "Melvin Achterhuis"
|
||||
},
|
||||
{
|
||||
"name": "Nils Gerhardt | SLINIcraftet204"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"shopware/core": "6.4.*",
|
||||
"shopware/core": "6.6.*",
|
||||
"ext-curl": "*"
|
||||
},
|
||||
"autoload": {
|
||||
|
@ -4,6 +4,5 @@ namespace Melv\Turnstile;
|
||||
|
||||
use Shopware\Core\Framework\Plugin;
|
||||
|
||||
class MelvTurnstile extends Plugin
|
||||
{
|
||||
class MelvTurnstile extends Plugin {
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ class Migration1664374217addTurnStileCaptcha extends MigrationStep
|
||||
public function update(Connection $connection): void
|
||||
{
|
||||
//TODO: Can we prevent overriding current CAPTCHA settings?
|
||||
$configId = $connection->fetchColumn('SELECT id FROM system_config WHERE configuration_key = :key AND updated_at IS NULL', [
|
||||
$configId = $connection->fetchOne('SELECT id FROM system_config WHERE configuration_key = :key AND updated_at IS NULL', [
|
||||
'key' => self::CONFIG_KEY,
|
||||
]);
|
||||
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 5.1 KiB After Width: | Height: | Size: 37 KiB |
@ -1 +1,69 @@
|
||||
!function(e){var t={};function n(l){if(t[l])return t[l].exports;var r=t[l]={i:l,l:!1,exports:{}};return e[l].call(r.exports,r,r.exports,n),r.l=!0,r.exports}n.m=e,n.c=t,n.d=function(e,t,l){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:l})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var l=Object.create(null);if(n.r(l),Object.defineProperty(l,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(l,r,function(t){return e[t]}.bind(null,r));return l},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/bundles/melvturnstile/",n(n.s="wNoc")}({"+t2p":function(e){e.exports=JSON.parse('{"sw-settings-basic-information":{"captcha":{"label":{"cloudFlareTurnstile":"CloudFlare Turnstile","cloudFlareTurnstileSiteKey":"CloudFlare Turnstile site key","cloudFlareTurnstileSecretKey":"CloudFlare Turnstile secret key","cloudFlareTurnstileDescription":"Turnstile is CloudFlare\'s CAPTCHA alternative. It automatically chooses from a rotating suite of non-intrusive browser challenges based on telemetry and client behavior exhibited during a session."}}}}')},"R+yN":function(e){e.exports=JSON.parse('{"sw-settings-basic-information":{"captcha":{"label":{"cloudFlareTurnstile":"CloudFlare Turnstile","cloudFlareTurnstileSiteKey":"CloudFlare Turnstile site key","cloudFlareTurnstileSecretKey":"CloudFlare Turnstile secret key","cloudFlareTurnstileDescription":"Turnstile is CloudFlare\'s CAPTCHA alternative. It automatically chooses from a rotating suite of non-intrusive browser challenges based on telemetry and client behavior exhibited during a session."}}}}')},wNoc:function(e,t,n){"use strict";n.r(t);var l=n("+t2p"),r=n("R+yN"),s=Shopware,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 <sw-container\n v-if="currentValue.cloudFlareTurnstile.isActive"\n class="sw-settings-captcha-select-v2__cloudflare-turnstile"\n >\n\n \n {% block sw_settings_captcha_select_v2_cloudflare_turnstile_description %}\n <p class="sw-settings-captcha-select-v2__description sw-settings-captcha-select-v2__cloudflare-turnstile-description">\n {{ $tc(\'sw-settings-basic-information.captcha.label.cloudFlareTurnstileDescription\') }}\n </p>\n {% endblock %}\n\n \n {% block sw_settings_captcha_select_v2_cloudflare_turnstile_site_key %}\n <sw-text-field\n v-model="currentValue.cloudFlareTurnstile.config.siteKey"\n name="cloudFlareTurnstileSiteKey"\n :label="$tc(\'sw-settings-basic-information.captcha.label.cloudFlareTurnstileSiteKey\')"\n />\n {% endblock %}\n\n \n {% block sw_settings_captcha_select_v2_cloudflare_turnstile_secret_key %}\n <sw-text-field\n v-model="currentValue.cloudFlareTurnstile.config.secretKey"\n name="cloudFlareTurnstileSecretKey"\n :label="$tc(\'sw-settings-basic-information.captcha.label.cloudFlareTurnstileSecretKey\')"\n />\n {% endblock %}\n </sw-container>\n {% endblock %}\n{% endblock %}'})}});
|
||||
Shopware.Component.override('sw-settings-captcha-select-v2', {
|
||||
template: `
|
||||
{% block sw_settings_captcha_select_v2_google_recaptcha_v2 %}
|
||||
{% parent() %}
|
||||
{% block sw_settings_captcha_select_v2_cloudflare_turnstile %}
|
||||
<sw-container
|
||||
v-if="currentValue.cloudFlareTurnstile && currentValue.cloudFlareTurnstile.isActive"
|
||||
class="sw-settings-captcha-select-v2__cloudflare-turnstile"
|
||||
>
|
||||
{% block sw_settings_captcha_select_v2_cloudflare_turnstile_description %}
|
||||
<p class="sw-settings-captcha-select-v2__description">
|
||||
{{ $tc('sw-settings-basic-information.captcha.label.cloudFlareTurnstileDescription') }}
|
||||
</p>
|
||||
{% endblock %}
|
||||
|
||||
{% block sw_settings_captcha_select_v2_cloudflare_turnstile_site_key %}
|
||||
<sw-text-field
|
||||
v-model="currentValue.cloudFlareTurnstile.config.siteKey"
|
||||
name="cloudFlareTurnstileSiteKey"
|
||||
:label="$tc('sw-settings-basic-information.captcha.label.cloudFlareTurnstileSiteKey')"
|
||||
/>
|
||||
{% endblock %}
|
||||
|
||||
{% block sw_settings_captcha_select_v2_cloudflare_turnstile_secret_key %}
|
||||
<sw-text-field
|
||||
v-model="currentValue.cloudFlareTurnstile.config.secretKey"
|
||||
name="cloudFlareTurnstileSecretKey"
|
||||
:label="$tc('sw-settings-basic-information.captcha.label.cloudFlareTurnstileSecretKey')"
|
||||
/>
|
||||
{% endblock %}
|
||||
</sw-container>
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
`,
|
||||
|
||||
created() {
|
||||
this.initConfig();
|
||||
},
|
||||
|
||||
methods: {
|
||||
initConfig() {
|
||||
if (!this.currentValue.cloudFlareTurnstile) {
|
||||
this.$set(this.currentValue, 'cloudFlareTurnstile', {
|
||||
isActive: false,
|
||||
config: {
|
||||
siteKey: '',
|
||||
secretKey: ''
|
||||
}
|
||||
});
|
||||
} else if (!this.currentValue.cloudFlareTurnstile.config) {
|
||||
this.$set(this.currentValue.cloudFlareTurnstile, 'config', {
|
||||
siteKey: '',
|
||||
secretKey: ''
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
watch: {
|
||||
'currentValue.cloudFlareTurnstile.config': {
|
||||
deep: true,
|
||||
handler(newValue) {
|
||||
// Stellen Sie sicher, dass die Änderungen persistent sind
|
||||
this.$emit('input', this.currentValue);
|
||||
console.log('currentValue.cloudFlareTurnstile:', this.currentValue.cloudFlareTurnstile);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"captcha": {
|
||||
"cloudFlareTurnstile": {
|
||||
"dataProtectionInformation": "This site is protected by Turnstile and the CloudFlare <a href=\"https://www.cloudflare.com/en-gb/privacypolicy/\">Privacy Policy</a> and <a href=\"https://www.cloudflare.com/en-gb/website-terms/\">Terms of Service</a> apply."
|
||||
"dataProtectionInformation": "Dieser Shop wird durch CloudFlare Turnstile geschützt <a href=\"https://www.cloudflare.com/en-gb/privacypolicy/\">Privacy Policy</a> and <a href=\"https://www.cloudflare.com/en-gb/website-terms/\">Terms of Service</a> apply."
|
||||
}
|
||||
}
|
||||
}
|
@ -28,7 +28,7 @@ class CloudFlareTurnstile extends AbstractCaptcha
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function isValid(Request $request /* , array $captchaConfig */): bool
|
||||
public function isValid(Request $request , array $captchaConfig): bool
|
||||
{
|
||||
if (\func_num_args() < 2 || !\is_array(func_get_arg(1))) {
|
||||
Feature::triggerDeprecationOrThrow(
|
||||
|
Reference in New Issue
Block a user