Skip to content

Commit 6031192

Browse files
Merge pull request #184 from springload/fix/submission-email-links
Fix some unexpected issues with the form submission emails
2 parents 2a08b2b + 48cb66b commit 6031192

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

core/models.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from modelcluster.tags import ClusterTaggableManager
88
from taggit.models import Tag, TaggedItemBase
99
from wagtailcaptcha.models import WagtailCaptchaEmailForm
10+
from wagtailcaptcha.forms import remove_captcha_field
1011

1112
from django.conf import settings
1213
from django.core.exceptions import ObjectDoesNotExist
@@ -549,6 +550,9 @@ class Meta:
549550
def process_form_submission(self, form):
550551
# Reproduce EmailFormMixin, but passing the submission to send_mail
551552
submission = AbstractForm.process_form_submission(self, form)
553+
# this is part of the recaptcha field, but we skip
554+
# it cos of using AbstractForm directly
555+
remove_captcha_field(form)
552556
if self.to_address:
553557
self.send_mail(form, submission=submission)
554558
return submission
@@ -573,7 +577,7 @@ def render_email(self, form, submission=None):
573577
url = self.get_site().root_url + path
574578
body += textwrap.dedent(
575579
f"""
576-
<a href="{url}?pk={submission.id}">Submission {submission.id}</a>
580+
Submission: {url}?pk={submission.id}
577581
"""
578582
)
579583
return body

madewithwagtail/settings/dev.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,8 @@
4545
ALLOWED_HOSTS = ["*"]
4646

4747
CACHE_MIDDLEWARE_SECONDS = 0
48-
# Change these if you want to enable recaptcha on submissions form
49-
# https://github.com/springload/wagtail-django-recaptcha
50-
RECAPTCHA_PUBLIC_KEY = ""
51-
RECAPTCHA_PRIVATE_KEY = ""
48+
49+
# Disable captcha (if configured otherwise)
5250
NOCAPTCHA = False
5351

5452

0 commit comments

Comments
 (0)