Skip to content

Commit 8be70d4

Browse files
committed
reset captcha when submitting form
1 parent b52ccd0 commit 8be70d4

File tree

8 files changed

+9
-11
lines changed

8 files changed

+9
-11
lines changed

assets/js/cardpayments.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,8 @@ class OneTimePayment {
1919
* @param {boolean} status.inProgress Whether an async payment task is currently running
2020
* @param {boolean} status.success Whether the payment succeeded
2121
*/
22-
constructor(status, captcha) {
22+
constructor(status) {
2323
this._status = status;
24-
this._captcha = captcha;
2524
}
2625

2726
/**
@@ -128,7 +127,6 @@ class OneTimePayment {
128127
this._status.success = false;
129128
this._status.errorMessage = error.message;
130129
this._status.inProgress = false;
131-
this._captcha.reset();
132130
}
133131

134132
onPaymentSucceeded() {

layouts/hub-billing/single.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{{ define "main" }}
22
<div class="container pt-12 pb-24">
3-
<form x-data="{subscriptionData: {state: 'MISSING_PARAMS', captcha: null, hubId: null, returnUrl: null, session: null, customBilling: null, monthlyPrice: null, errorMessage: '', inProgress: false, restartModal: {open: false, nextPayment: null}, changeSeatsModal: {open: false, confirmation: false, immediatePayment: null}, token: null, details: null, quantity: 5, email: ''}, acceptTerms: false, hubSubscription: null, captchaState: null}" x-init="hubSubscription = new HubSubscription($refs.form, subscriptionData, new URLSearchParams(location.search))" x-ref="form" @submit.prevent="hubSubscription.createSession()">
3+
<form x-data="{subscriptionData: {state: 'MISSING_PARAMS', captcha: null, hubId: null, returnUrl: null, session: null, customBilling: null, monthlyPrice: null, errorMessage: '', inProgress: false, restartModal: {open: false, nextPayment: null}, changeSeatsModal: {open: false, confirmation: false, immediatePayment: null}, token: null, details: null, quantity: 5, email: ''}, acceptTerms: false, hubSubscription: null, captchaState: null}" x-init="hubSubscription = new HubSubscription($refs.form, subscriptionData, new URLSearchParams(location.search))" x-ref="form" @submit.prevent="hubSubscription.createSession(); $refs.captcha.reset()">
44
<template x-if="subscriptionData.state == 'MISSING_PARAMS'">
55
<div class="text-center max-w-xl mx-auto">
66
<h3 class="font-headline text-xl md:text-2xl leading-relaxed mb-4">

layouts/hub-demo/single.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ <h1 class="font-h1 mb-8">{{ .Title }}</h1>
55
<p class="lead">{{ i18n "hub_demo_description" }}</p>
66
</header>
77

8-
<form x-ref="form" @submit.prevent="hubDemo.request()">
8+
<form x-ref="form" @submit.prevent="hubDemo.request(); $refs.captcha.reset()">
99
<section class="relative white-box">
1010
<div x-show="!feedbackData.success" class="px-4 py-5 md:p-6 md:grid md:grid-cols-3 md:gap-6">
1111
<header class="md:col-span-1">

layouts/hub-managed/single.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ <h1 class="font-h1 mb-8">{{ .Title }}</h1>
55
<p class="lead">{{ i18n "hub_managed_description" }}</p>
66
</header>
77

8-
<form x-ref="form" @submit.prevent="hubManaged.request()">
8+
<form x-ref="form" @submit.prevent="hubManaged.request(); $refs.captcha.reset()">
99
<section class="white-box">
1010
<div x-show="!feedbackData.success" class="md:min-h-110 px-4 py-5 md:p-6 md:grid md:grid-cols-3 md:gap-6">
1111
<header class="mb-8 md:col-span-1 md:mt-4">

layouts/partials/donate-creditcard.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<div x-data="{amount: 15, currency: 'EUR', frequency: 'once', oneTimePayment: null, oneTimePaymentStatus: {validCardNum: false, captcha: null, errorMessage: '', inProgress: false, success: false}, recurringPayment: new RecurringPayment(), acceptTerms: false, captchaState: null}" x-init="oneTimePayment = new OneTimePayment(oneTimePaymentStatus, $refs.captcha)">
1+
<div x-data="{amount: 15, currency: 'EUR', frequency: 'once', oneTimePayment: null, oneTimePaymentStatus: {validCardNum: false, captcha: null, errorMessage: '', inProgress: false, success: false}, recurringPayment: new RecurringPayment(), acceptTerms: false, captchaState: null}" x-init="oneTimePayment = new OneTimePayment(oneTimePaymentStatus)">
22
<div class="flex flex-wrap md:flex-nowrap">
33
<div class="w-full mb-4 md:w-1/2 md:pr-3">
44
<label class="label-uppercase mb-2">{{ i18n "donate_creditcard_amount" }}</label>
@@ -29,7 +29,7 @@
2929
</div>
3030
</div>
3131

32-
<form x-show="frequency === 'once'" @submit.prevent="oneTimePayment.charge(amount, currency)">
32+
<form x-show="frequency === 'once'" @submit.prevent="oneTimePayment.charge(amount, currency); $refs.captcha.reset()">
3333
<div class="mb-4">
3434
<label class="label-uppercase mb-2">{{ i18n "donate_creditcard_number" }}</label>
3535
<div> <!-- wrapper needed for stripe text field -->

layouts/partials/supporter-cert-contributor.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<div x-data="{feedbackData: {success: false, inProgress: false, errorMessage: ''}, submitData: {captcha: null, type: 'contributor', email: '', github_username: '', github_contribution_link: ''}, acceptTerms: false, captchaState: null}">
2-
<form x-show="!feedbackData.success" x-ref="form" @submit.prevent="new SupporterCertificate($refs.form, feedbackData, submitData).request()">
2+
<form x-show="!feedbackData.success" x-ref="form" @submit.prevent="new SupporterCertificate($refs.form, feedbackData, submitData).request(); $refs.captcha.reset()">
33
<div class="mb-4">
44
<label class="label-uppercase mb-2">{{ i18n "supporter_cert_contributor_github_username" }}</label>
55
<input x-model="submitData.github_username" x-ref="github_username" @blur="$refs.github_username.classList.add('show-invalid')" type="text" class="input-box w-full" pattern="^[A-Za-z\d](?:[A-Za-z\d]|-(?=[A-Za-z\d])){0,38}$" maxlength="39" placeholder="{{ i18n "supporter_cert_contributor_github_username_placeholder" }}" required/>

layouts/partials/supporter-cert-influencer.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<div x-data="{feedbackData: {success: false, inProgress: false, errorMessage: ''}, submitData: {captcha: null, type: 'influencer', email: '', reference: ''}, acceptTerms: false, captchaState: null}">
2-
<form x-show="!feedbackData.success" x-ref="form" @submit.prevent="new SupporterCertificate($refs.form, feedbackData, submitData).request()">
2+
<form x-show="!feedbackData.success" x-ref="form" @submit.prevent="new SupporterCertificate($refs.form, feedbackData, submitData).request(); $refs.captcha.reset()">
33
<div class="mb-4">
44
<label class="label-uppercase mb-2">{{ i18n "supporter_cert_influencer_reference" }}</label>
55
<textarea x-model="submitData.reference" x-ref="reference" @blur="$refs.reference.classList.add('show-invalid')" type="url" class="input-box w-full" rows="5" maxlength="800" placeholder="{{ i18n "supporter_cert_influencer_reference_placeholder" }}" required></textarea>

layouts/partials/supporter-cert-other.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<div x-data="{feedbackData: {success: false, inProgress: false, errorMessage: ''}, submitData: {captcha: null, type: 'other', email: '', reason: ''}, acceptTerms: false, captchaState: null}">
2-
<form x-show="!feedbackData.success" x-ref="form" @submit.prevent="new SupporterCertificate($refs.form, feedbackData, submitData).request()">
2+
<form x-show="!feedbackData.success" x-ref="form" @submit.prevent="new SupporterCertificate($refs.form, feedbackData, submitData).request(); $refs.captcha.reset()">
33
<div class="mb-4">
44
<label class="label-uppercase mb-2">{{ i18n "supporter_cert_other_reason" }}</label>
55
<textarea x-model="submitData.reason" x-ref="reason" @blur="$refs.reason.classList.add('show-invalid')" type="url" class="input-box w-full" rows="5" maxlength="800" placeholder="{{ i18n "supporter_cert_other_reason_placeholder" }}" required></textarea>

0 commit comments

Comments
 (0)