Skip to content

Commit 6c1601f

Browse files
committed
Captcha
1 parent 3bd71c7 commit 6c1601f

File tree

17 files changed

+143
-87
lines changed

17 files changed

+143
-87
lines changed

assets/js/cardpayments.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class OneTimePayment {
1414
* Initializes the one-time payments helper and stores a references to the status object that can be observed by AlpineJS
1515
* @param {Object} status
1616
* @param {boolean} status.validCardNum Whether the Stripe input field considers the credit card number valid
17-
* @param {string} status.captcha The captcha (if reCAPTCHA validation finished) or null
17+
* @param {string} status.captcha The captcha (if captcha validation finished) or null
1818
* @param {string} status.errorMessage An error message or null
1919
* @param {boolean} status.inProgress Whether an async payment task is currently running
2020
* @param {boolean} status.success Whether the payment succeeded
@@ -127,9 +127,9 @@ class OneTimePayment {
127127
this._status.success = false;
128128
this._status.errorMessage = error.message;
129129
this._status.inProgress = false;
130-
if (grecaptcha) {
130+
if (captcha) {
131131
this._status.captcha = '';
132-
grecaptcha.reset();
132+
captcha.reset();
133133
}
134134
}
135135

@@ -138,9 +138,9 @@ class OneTimePayment {
138138
this._status.success = true;
139139
this._status.errorMessage = '';
140140
this._status.inProgress = false;
141-
if (grecaptcha) {
141+
if (captcha) {
142142
this._status.captcha = '';
143-
grecaptcha.reset();
143+
captcha.reset();
144144
}
145145
}
146146

assets/js/recaptcha.js

Lines changed: 0 additions & 26 deletions
This file was deleted.

hugo.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ enableemoji = true
5757
source = "node_modules/js-yaml/dist"
5858
target = "assets/js/js-yaml"
5959

60+
[[module.mounts]]
61+
source = "node_modules/altcha/dist_external"
62+
target = "assets/js/altcha"
63+
6064
[markup.goldmark.renderer]
6165
unsafe = true
6266

@@ -121,6 +125,6 @@ block = true
121125
[[server.headers]]
122126
for = '/**'
123127
[server.headers.values]
124-
Content-Security-Policy = "default-src 'none'; script-src 'self' 'unsafe-eval' https://umami.skymatic.de/ https://plausible.skymatic.de/ https://community.cryptomator.org/ https://js.stripe.com/ https://*.paddle.com/ https://www.google.com/ https://www.gstatic.com/; style-src 'self' 'unsafe-inline' https://*.paddle.com/; img-src 'self' data: https://static.cryptomator.org/ https://*.paddle.com/ https://paddle.s3.amazonaws.com/; connect-src 'self' https://api.cryptomator.org/ https://store.cryptomator.org/ https://umami.skymatic.de/ https://plausible.skymatic.de/ http://localhost:8787/; font-src 'self'; media-src https://static.cryptomator.org/; frame-src https://community.cryptomator.org/ https://js.stripe.com/ https://*.paddle.com/ https://www.google.com/; base-uri 'self'; form-action 'self' https://www.paypal.com/ https://www.coinpayments.net/; frame-ancestors 'none'"
128+
Content-Security-Policy = "default-src 'none'; script-src 'self' 'unsafe-eval' https://umami.skymatic.de/ https://plausible.skymatic.de/ https://community.cryptomator.org/ https://js.stripe.com/ https://*.paddle.com/; style-src 'self' 'unsafe-inline' https://*.paddle.com/; img-src 'self' data: https://static.cryptomator.org/ https://*.paddle.com/ https://paddle.s3.amazonaws.com/; connect-src 'self' https://api.cryptomator.org/ https://store.cryptomator.org/ https://windmill.skymatic.de/ https://umami.skymatic.de/ https://plausible.skymatic.de/ http://localhost:8787/; font-src 'self'; media-src https://static.cryptomator.org/; frame-src https://community.cryptomator.org/ https://js.stripe.com/ https://*.paddle.com/; base-uri 'self'; form-action 'self' https://www.paypal.com/ https://www.coinpayments.net/; frame-ancestors 'none';"
125129
Strict-Transport-Security = "max-age=31536000; includeSubDomains"
126130
X-Content-Type-Options = "nosniff"

i18n/de.yaml

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,6 @@
135135
translation: "Kreditkartenzahlungen werden über Stripe abgewickelt. Wir können dabei weder deine Kartennummer noch die Prüfziffer einsehen. In deiner Abrechnung wird <a class=\"text-link\" href=\"https://support.stripe.com/questions/unknown-charge-on-card-from-stripe\" target=\"_blank\" rel=\"noopener\">eine Buchung von Stripe</a> enthalten sein."
136136
- id: donate_creditcard_once_loading
137137
translation: "Lädt…"
138-
- id: donate_creditcard_once_loadcaptcha
139-
translation: "Weiter…"
140138
- id: donate_creditcard_once_paynow
141139
translation: "Jetzt bezahlen"
142140
- id: donate_creditcard_once_success
@@ -445,8 +443,6 @@
445443
translation: "Um auf deine Abonnement-Informationen zuzugreifen, wird ein Bestätigungslink an die E-Mail-Adresse gesendet, die du für den Kauf verwendet hast."
446444
- id: hub_billing_createsession_success_description
447445
translation: "Bitte überprüfe deine E-Mails auf den Link zur Verwaltung deines Hub-Abonnements."
448-
- id: hub_billing_createsession_loadcaptcha
449-
translation: "Weiter…"
450446
- id: hub_billing_createsession_submit
451447
translation: "Zugang anfordern"
452448

@@ -584,8 +580,6 @@
584580

585581
- id: hub_demo_instruction
586582
translation: "Demo-Instanzen werden automatisch erstellt. Es gibt eine begrenzte Anzahl von Demo-Instanzen. Alle Demo-Instanzen werden um 00:00 UTC zurückgesetzt."
587-
- id: hub_demo_loadcaptcha
588-
translation: "Weiter…"
589583
- id: hub_demo_submit
590584
translation: "Demo ausprobieren"
591585
- id: hub_demo_success_title
@@ -926,8 +920,6 @@
926920
translation: "E-Mail"
927921
- id: supporter_cert_common_email_placeholder
928922
translation: "E-Mail-Adresse"
929-
- id: supporter_cert_common_loadcaptcha
930-
translation: "Weiter…"
931923
- id: supporter_cert_common_submit
932924
translation: "Anfrage senden"
933925
- id: supporter_cert_common_success_title
@@ -993,3 +985,17 @@
993985
translation: "Wir haben dir die Details zu deinen vergangenen Transaktionen und Lizenzen per E-Mail zugesandt."
994986
- id: supporter_cert_recovery_contact_us
995987
translation: "Wenn du keine E-Mail bekommen hast, <a class=\"text-link\" href=\"mailto:[email protected]\">kontaktiere uns</a>."
988+
989+
# Altcha
990+
- id: altcha_label
991+
translation: "Ich bin kein Bot"
992+
- id: altcha_error
993+
translation: "Verifizierung fehlgeschlagen. Versuche es später erneut."
994+
- id: altcha_expired
995+
translation: "Verifizierung abgelaufen. Bitte erneut versuchen."
996+
- id: altcha_verified
997+
translation: "Verifiziert!"
998+
- id: altcha_verifying
999+
translation: "Wird überprüft..."
1000+
- id: altcha_waitAlert
1001+
translation: "Verifizierung...bitte warten."

i18n/en.yaml

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,6 @@
135135
translation: "Credit card payments are securely handled by Stripe. We will not be able to see your card number or CVC. Please expect to be <a class=\"text-link\" href=\"https://support.stripe.com/questions/unknown-charge-on-card-from-stripe\" target=\"_blank\" rel=\"noopener\">charged by Stripe</a>."
136136
- id: donate_creditcard_once_loading
137137
translation: "Loading…"
138-
- id: donate_creditcard_once_loadcaptcha
139-
translation: "Continue…"
140138
- id: donate_creditcard_once_paynow
141139
translation: "Pay Now"
142140
- id: donate_creditcard_once_success
@@ -445,8 +443,6 @@
445443
translation: "To access your subscription information, a confirmation link will be sent to the email you used to make your purchase."
446444
- id: hub_billing_createsession_success_description
447445
translation: "Please check your email for the link to manage your Hub subscription."
448-
- id: hub_billing_createsession_loadcaptcha
449-
translation: "Continue…"
450446
- id: hub_billing_createsession_submit
451447
translation: "Request Access"
452448

@@ -584,8 +580,6 @@
584580

585581
- id: hub_demo_instruction
586582
translation: "Demo instances are created automatically. There are a limited number of demo instances available. All demo instances are reset at 00:00 UTC."
587-
- id: hub_demo_loadcaptcha
588-
translation: "Continue…"
589583
- id: hub_demo_submit
590584
translation: "Try Demo"
591585
- id: hub_demo_success_title
@@ -926,8 +920,6 @@
926920
translation: "Email"
927921
- id: supporter_cert_common_email_placeholder
928922
translation: "Email address"
929-
- id: supporter_cert_common_loadcaptcha
930-
translation: "Continue…"
931923
- id: supporter_cert_common_submit
932924
translation: "Send Request"
933925
- id: supporter_cert_common_success_title
@@ -993,3 +985,17 @@
993985
translation: "We've sent details of your past transactions and licenses to you via email."
994986
- id: supporter_cert_recovery_contact_us
995987
translation: "If you didn't get an email, <a class=\"text-link\" href=\"mailto:[email protected]\">contact us</a>."
988+
989+
# Altcha
990+
- id: altcha_label
991+
translation: "I'm not a bot"
992+
- id: altcha_error
993+
translation: "Verification failed. Try again later."
994+
- id: altcha_expired
995+
translation: "Verification expired. Try again."
996+
- id: altcha_verified
997+
translation: "Verified!"
998+
- id: altcha_verifying
999+
translation: "Verifying..."
1000+
- id: altcha_waitAlert
1001+
translation: "Verifying... please wait."

layouts/donate/list.html

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,19 @@ <h3 class="font-headline text-xl md:text-2xl leading-relaxed mb-4">{{ i18n "dona
7272
{{ if hugo.IsDevelopment }}
7373
{{ $customerPortalJs := resources.Get "js/customerportal.js" }}
7474
<script type="text/javascript" src="{{ $customerPortalJs.RelPermalink }}" defer></script>
75-
{{ $recaptchaJs := resources.Get "js/recaptcha.js" }}
76-
<script type="text/javascript" src="{{ $recaptchaJs.RelPermalink }}" defer></script>
75+
{{ $altchaJs := resources.Get "js/altcha/altcha.js" }}
76+
<script type="module" type="text/javascript" src="{{ $altchaJs.RelPermalink }}" defer></script>
77+
{{ $altchaWorkerJs := resources.Get "js/altcha/worker.js" }}
78+
<script type="module" type="text/javascript" src="{{ $altchaWorkerJs.RelPermalink }}" defer></script>
7779
{{ $cardPaymentsJs := resources.Get "js/cardpayments.js" }}
7880
<script type="text/javascript" src="{{ $cardPaymentsJs.RelPermalink }}" defer></script>
7981
{{ else }}
8082
{{ $customerPortalJs := resources.Get "js/customerportal.js" | minify | fingerprint }}
8183
<script type="text/javascript" src="{{ $customerPortalJs.RelPermalink }}" integrity="{{ $customerPortalJs.Data.Integrity }}" defer></script>
82-
{{ $recaptchaJs := resources.Get "js/recaptcha.js" | minify | fingerprint }}
83-
<script type="text/javascript" src="{{ $recaptchaJs.RelPermalink }}" integrity="{{ $recaptchaJs.Data.Integrity }}" defer></script>
84+
{{ $altchaJs := resources.Get "js/altcha/altcha.js" }}
85+
<script type="module" type="text/javascript" src="{{ $altchaJs.RelPermalink }}" integrity="{{ $altchaJs.Data.Integrity }}" defer></script>
86+
{{ $altchaWorkerJs := resources.Get "js/altcha/worker.js" }}
87+
<script type="module" type="text/javascript" src="{{ $altchaWorkerJs.RelPermalink }}" integrity="{{ $altchaWorkerJs.Data.Integrity }}" defer></script>
8488
{{ $cardPaymentsJs := resources.Get "js/cardpayments.js" | minify | fingerprint }}
8589
<script type="text/javascript" src="{{ $cardPaymentsJs.RelPermalink }}" integrity="{{ $cardPaymentsJs.Data.Integrity }}" defer></script>
8690
{{ end }}

layouts/hub-billing/single.html

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ <h3 class="font-headline text-xl md:text-2xl leading-relaxed mb-4">
3535
<i class="fas fa-sign-in fa-fw"></i>
3636
{{ i18n "hub_billing_createsession_description" . }}
3737
</p>
38-
<div x-show="!subscriptionData.captcha" x-ref="captchaWrapper" class="flex justify-center">
39-
<button @click.prevent="loadRecaptcha($refs.captchaWrapper, (token) => subscriptionData.captcha = token)" class="btn btn-primary w-full md:w-64">{{ i18n "hub_billing_createsession_loadcaptcha" }}</button>
38+
<div class="mb-2">
39+
{{ partial "captcha.html" (dict "alpineVariable" "subscriptionData.captcha") }}
4040
</div>
4141
<button x-show="subscriptionData.captcha" :disabled="subscriptionData.inProgress" @click.prevent="hubSubscription.createSession()" type="submit" class="btn btn-primary w-full md:w-64">
4242
<i :class="{'fa-paper-plane': !subscriptionData.inProgress, 'fa-spinner fa-spin': subscriptionData.inProgress}" class="fas fa-fw" aria-hidden="true"></i>
@@ -455,14 +455,18 @@ <h3 class="font-headline text-xl md:text-2xl leading-relaxed mb-4">
455455
<script type="text/javascript" src="{{ $storeJs.RelPermalink }}" defer></script>
456456
{{ $hubSubscriptionJs := resources.Get "js/hubsubscription.js" }}
457457
<script type="text/javascript" src="{{ $hubSubscriptionJs.RelPermalink }}" defer></script>
458-
{{ $recaptchaJs := resources.Get "js/recaptcha.js" }}
459-
<script type="text/javascript" src="{{ $recaptchaJs.RelPermalink }}" defer></script>
458+
{{ $altchaJs := resources.Get "js/altcha/altcha.js" }}
459+
<script type="module" type="text/javascript" src="{{ $altchaJs.RelPermalink }}" defer></script>
460+
{{ $altchaWorkerJs := resources.Get "js/altcha/worker.js" }}
461+
<script type="module" type="text/javascript" src="{{ $altchaWorkerJs.RelPermalink }}" defer></script>
460462
{{ else }}
461463
{{ $storeJs := resources.Get "js/store.prod.js" | resources.ExecuteAsTemplate "js/store.js" . | minify | fingerprint }}
462464
<script type="text/javascript" src="{{ $storeJs.RelPermalink }}" integrity="{{ $storeJs.Data.Integrity }}" defer></script>
463465
{{ $hubSubscriptionJs := resources.Get "js/hubsubscription.js" | minify | fingerprint }}
464466
<script type="text/javascript" src="{{ $hubSubscriptionJs.RelPermalink }}" integrity="{{ $hubSubscriptionJs.Data.Integrity }}" defer></script>
465-
{{ $recaptchaJs := resources.Get "js/recaptcha.js" | minify | fingerprint }}
466-
<script type="text/javascript" src="{{ $recaptchaJs.RelPermalink }}" integrity="{{ $recaptchaJs.Data.Integrity }}" defer></script>
467+
{{ $altchaJs := resources.Get "js/altcha/altcha.js" }}
468+
<script type="module" type="text/javascript" src="{{ $altchaJs.RelPermalink }}" integrity="{{ $altchaJs.Data.Integrity }}" defer></script>
469+
{{ $altchaWorkerJs := resources.Get "js/altcha/worker.js" }}
470+
<script type="module" type="text/javascript" src="{{ $altchaWorkerJs.RelPermalink }}" integrity="{{ $altchaWorkerJs.Data.Integrity }}" defer></script>
467471
{{ end }}
468472
{{ end }}

layouts/hub-demo/single.html

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ <h3 class="font-h3">
5858
<p class="font-p mb-4">
5959
{{ i18n "hub_demo_instruction" }}
6060
</p>
61-
<div x-show="!submitData.captcha" x-ref="captchaWrapper" class="flex justify-center">
62-
<button @click.prevent="loadRecaptcha($refs.captchaWrapper, (token) => submitData.captcha = token)" class="btn btn-primary w-full md:w-64">{{ i18n "hub_demo_loadcaptcha" }}</button>
61+
<div class="mb-4">
62+
{{ partial "captcha.html" (dict "alpineVariable" "submitData.captcha") }}
6363
</div>
6464
<button x-show="submitData.captcha" :disabled="feedbackData.inProgress" @click.prevent="hubDemo.request()" type="submit" class="btn btn-primary w-full md:w-64" x-cloak>
6565
<i :class="{'fa-paper-plane': !feedbackData.inProgress, 'fa-spinner fa-spin': feedbackData.inProgress}" class="fas fa-fw" aria-hidden="true"></i> {{ i18n "hub_demo_submit" }}
@@ -83,14 +83,18 @@ <h2 class="font-h2 mb-4">{{ i18n "hub_demo_contact_us_title" . }}</h2>
8383
<script type="text/javascript" src="{{ $storeJs.RelPermalink }}" defer></script>
8484
{{ $hubDemoJs := resources.Get "js/hubdemo.js" }}
8585
<script type="text/javascript" src="{{ $hubDemoJs.RelPermalink }}" defer></script>
86-
{{ $recaptchaJs := resources.Get "js/recaptcha.js" }}
87-
<script type="text/javascript" src="{{ $recaptchaJs.RelPermalink }}" defer></script>
86+
{{ $altchaJs := resources.Get "js/altcha/altcha.js" }}
87+
<script type="module" type="text/javascript" src="{{ $altchaJs.RelPermalink }}" defer></script>
88+
{{ $altchaWorkerJs := resources.Get "js/altcha/worker.js" }}
89+
<script type="module" type="text/javascript" src="{{ $altchaWorkerJs.RelPermalink }}" defer></script>
8890
{{ else }}
8991
{{ $storeJs := resources.Get "js/store.prod.js" | resources.ExecuteAsTemplate "js/store.js" . | minify | fingerprint }}
9092
<script type="text/javascript" src="{{ $storeJs.RelPermalink }}" integrity="{{ $storeJs.Data.Integrity }}" defer></script>
9193
{{ $hubDemoJs := resources.Get "js/hubdemo.js" | minify | fingerprint }}
9294
<script type="text/javascript" src="{{ $hubDemoJs.RelPermalink }}" integrity="{{ $hubDemoJs.Data.Integrity }}" defer></script>
93-
{{ $recaptchaJs := resources.Get "js/recaptcha.js" | minify | fingerprint }}
94-
<script type="text/javascript" src="{{ $recaptchaJs.RelPermalink }}" integrity="{{ $recaptchaJs.Data.Integrity }}" defer></script>
95+
{{ $altchaJs := resources.Get "js/altcha/altcha.js" }}
96+
<script type="module" type="text/javascript" src="{{ $altchaJs.RelPermalink }}" integrity="{{ $altchaJs.Data.Integrity }}" defer></script>
97+
{{ $altchaWorkerJs := resources.Get "js/altcha/worker.js" }}
98+
<script type="module" type="text/javascript" src="{{ $altchaWorkerJs.RelPermalink }}" integrity="{{ $altchaWorkerJs.Data.Integrity }}" defer></script>
9599
{{ end }}
96100
{{ end }}

0 commit comments

Comments
 (0)